Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iterables-decorator-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

iterables_decorator-0.1.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

Details for the file iterables-decorator-0.1.0.tar.gz.

File metadata

  • Download URL: iterables-decorator-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for iterables-decorator-0.1.0.tar.gz
Algorithm Hash digest
SHA256 775f92f49f11236de4d0386e65646cd13fd06458a93a189d7eaede5b76727071
MD5 89abed90b4aba7e68f1a157fd92279c0
BLAKE2b-256 c934b0cb002ca6ae3e6fffa45315bc20cb62a9b2f087b1da7e4af15a85150e4a

See more details on using hashes here.

File details

Details for the file iterables_decorator-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for iterables_decorator-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fac3f1e3265b26aa668a1367f830e3d6c0754f783121fce7a18e8c6d336115c7
MD5 be0d7317218eee1f98a3a276406180bb
BLAKE2b-256 ed8d31253dfaea7c371282241a043fc35100c377c5877bbe92e5845864672685

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page