This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Zero-dependency scala-like case classes for Python 2 + 3.

Features

  • Simple usage: Just inherit from case_class.CaseClass
  • Simple Installation: Zero dependencies
  • plays well with inheritance
    • CaseClass and \(AbstractCaseClass\) usable as a Mix-In
    • Case-to-case inheritance forbidden by default
      • use AbstractCaseClass to allow only subclasses to be instantiated
      • use InheritableCaseClass to override allow both super and subclasses to be instantiated.`
    • also plays well with Multiple Inheritance * super() calls still work as expected
  • equality based on arguments
    • calls constructor only once per combination of arguments
    • works with == operator and is (referential equality) operator.
  • automatic repr() function
  • works in both Python 2 and Python 3!

Install

This package is published on the Python Package Index Installation can be done simply via pip:

pip install case_class

Alternatively, clone this repository and run setup.py:

git clone https://github.com/tkw1536/PythonCaseClass
python setup.py install

Examples

# Import the CaseClass module
from case_class import CaseClass

# Create a symbol case class
class Symbol(CaseClass):
    def __init__(self, name):
        self.name = name

# Create an instance
x = Symbol("x")
print(x)  # Symbol('x')

# And create another one
also_x = Symbol('x')
print(x == also_x)  # equality via operator
print(x is also_x)  # referential equality

Another example can be found in example.py.

License + Acknowledgements

This module and associated documentation is Copyright (c) Tom Wiesing 2016 and licensed under the MIT license, see license for details. Small parts of the code are adapted from the six module, which is Copyright (c) 2010-2015 Benjamin Peterson.

Release History

Release History

0.0.8

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
case_class-0.0.8-py2-none-any.whl (15.0 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Nov 24, 2016
case_class-0.0.8-py3-none-any.whl (15.0 kB) Copy SHA256 Checksum SHA256 3.5 Wheel Nov 24, 2016
case_class-0.0.8.tar.gz (12.2 kB) Copy SHA256 Checksum SHA256 Source Nov 24, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting