Command line utilities for information about now
Project description
Iterable decorator
Create iterable classes using a class decorator.
Values added to an iterable class are sored in the class's self.args
attribute as a tuple
of whatever type you have provided.
Examples
from iterables import iterable
@iterable
class Items:
# You can type annotate your iterable like so:
item: str
# Note that this has no real effect on the generation of the iterable.
items = Items("Hello", "iterables!")
for item in items:
print(item)
>>> "Hello"
>>> "iterables!"
You can attach additional methods to an iterable as you would with a dataclass.
from iterables import iterable
@iterable
class Items:
item: str
@classmethod
def from_list(data: list[str]):
return cls(*data)
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 Distribution
Built Distribution
Close
Hashes for iterables-decorator-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 775f92f49f11236de4d0386e65646cd13fd06458a93a189d7eaede5b76727071 |
|
MD5 | 89abed90b4aba7e68f1a157fd92279c0 |
|
BLAKE2b-256 | c934b0cb002ca6ae3e6fffa45315bc20cb62a9b2f087b1da7e4af15a85150e4a |
Close
Hashes for iterables_decorator-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fac3f1e3265b26aa668a1367f830e3d6c0754f783121fce7a18e8c6d336115c7 |
|
MD5 | be0d7317218eee1f98a3a276406180bb |
|
BLAKE2b-256 | ed8d31253dfaea7c371282241a043fc35100c377c5877bbe92e5845864672685 |