Initable is a Python package that helps create DRY-er classes.
pip install initable
Define an instance method you would like to be able to initialize the class with as well.
from initable import initializable class Foo(object): @initializable def bar(self, arg): self.baz = do_something(arg)
You can now call that method on the class and receive an initialized instance upon completion:
foo = Foo.bar(arg)
Or call the method on an existing instance:
foo = Foo() # do stuff... foo.bar(arg) # `bar()` is called on instance `foo`
Run the following from the root of the project:
poetry run pytest tests/
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size initable-0.1.2-py3-none-any.whl (23.9 kB)||File type Wheel||Python version py3||Upload date||Hashes View hashes|
|Filename, size initable-0.1.2.tar.gz (23.5 kB)||File type Source||Python version None||Upload date||Hashes View hashes|