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)
Release files for iterables-decorator 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| iterables-decorator-0.1.1.tar.gz | 2.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| iterables_decorator-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.8 kB
Release files / iterables-decorator-0.1.1.tar.gz
| Download URL | iterables-decorator-0.1.1.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0040c8338c29efb3dcd8b0163a3d8a785f695a71263913a25735e67443964fe5
|
|
BLAKE2b-256 checksum How to use checksums |
bc5e121bd795f8865b83035c737242105ce5cddaa0b31ebf49982110a7da72c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / iterables_decorator-0.1.1-py3-none-any.whl
| Download URL | iterables_decorator-0.1.1-py3-none-any.whl |
|---|---|
| Size | 2.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dd7d03588fd05261d5c55eb35f40b515ca5fd86759e0f6bfb03e863237f3209e
|
|
BLAKE2b-256 checksum How to use checksums |
0d4d8d321e5d001652389fd5a3df5f807fbbe6fa87ab16fce8c04607beebf11b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|