Enable function chaining for any object
Project description
Enable function chaining for any object.
Contained is a class that can wrap any type and make it possible to do function chaining on that object, much like functional piping.
Any method that is defined on the contained type is possible to call, whether it returns a copy or mutates in place. It is also possible to call operators and any builtin function, without breaking the chain. To get the original variable back out of the Contained, just call it with no args.
ex = ['hello', 'world']
Contained(ex)() == ex # True
# methods
Contained(['hello']).extend(['world'])() == ex # True
# operators
Contained(['hello']).add(['world']).contains('hello')() # True
# builtins
Contained(ex).len().type()() # <class 'int'>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for contained-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ee3d420c6270df58074779f98cd9b4df443b561da3011040187d48d9ea78ec2 |
|
MD5 | 16180e12fb0b890c5c2f1b40116e003b |
|
BLAKE2b-256 | 1f7af6ada2214d745d16fd5ae07b79d8b9957ed2de18d9da7f4416c793465e0c |