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
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
generates-0.1.0.tar.gz
(1.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca4185792658da26cbe5e6b3a8b71e16345f14504a0d41c856c96835764c83ca
|
|
| MD5 |
96d5d682a047c9dba63317b7ad9f139c
|
|
| BLAKE2b-256 |
1d390ae6693185435941c991a2c3874d8ff55b32028d3bd899b74d25e7402e54
|
File details
Details for the file generates-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: generates-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 3.7 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5fca8bef0bb9368f1d51fb14896892e6f274a81d8bfbe49a88ac52a133031eb
|
|
| MD5 |
9b75735b17be8a2b80801b96e6cccb84
|
|
| BLAKE2b-256 |
be4474833b56929ee2b27fd6032fe5806f5018420d26cb3770409eecfcf3ffd3
|