Skip to main content

Micro library providing generates decorator

Project description

Generates is a micro library providing generates decorator.

The generates decorator can be used to easily create a function that returns a container like list or dict, but using generator syntax in the function body. For example:

@generates(list)
def get_numbers(n):
    for i in range(n):
        yield i

assert get_numbers(5) == [0, 1, 2, 3, 4]

@generates(dict)
def get_map():
    yield ('key1', 'value1')
    yield ('key2', 'value2')

assert get_map() == {'key1': 'value1', 'key2': 'value2'}

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

generates-0.1.0.tar.gz (1.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generates-0.1.0-py2.py3-none-any.whl (3.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file generates-0.1.0.tar.gz.

File metadata

  • Download URL: generates-0.1.0.tar.gz
  • Upload date:
  • Size: 1.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for generates-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ca4185792658da26cbe5e6b3a8b71e16345f14504a0d41c856c96835764c83ca
MD5 96d5d682a047c9dba63317b7ad9f139c
BLAKE2b-256 1d390ae6693185435941c991a2c3874d8ff55b32028d3bd899b74d25e7402e54

See more details on using hashes here.

File details

Details for the file generates-0.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for generates-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d5fca8bef0bb9368f1d51fb14896892e6f274a81d8bfbe49a88ac52a133031eb
MD5 9b75735b17be8a2b80801b96e6cccb84
BLAKE2b-256 be4474833b56929ee2b27fd6032fe5806f5018420d26cb3770409eecfcf3ffd3

See more details on using hashes here.

Supported by

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