iterify

iterify streamlines making one-off iterators over one or a few values


Keywords
iterify
License
MIT
Install
pip install iterify==0.1.0

Documentation

iterify

Documentation Status

iterify streamlines making one-off iterators over one or a few values

import iterify as itfy



# itfy.iterify
[*itfy.iterify('a')] # -> ['a']

[*itfy.iterify('a', 'b', 'c')] # -> ['a', 'b', 'c']


# itfy.cyclify
[*zip([1, 2, 3], itfy.cyclify('a', 'b'))] # -> [(1, 'a'), (2, 'b'), (3, 'a')]


# itfy.samplify
[*zip(
  [1, 2, 3],
  itfy.samplify('a', 'b')
)]
# -> [(1, 'a'), (2, 'a'), (3, 'b')]
# or -> [(1, 'b'), (2, 'a'), (3, 'b')]
# or -> [(1, 'b'), (2, 'b'), (3, 'b')]
# etc.


# itfy.shufflify
[*itfy.shufflify('a', 'b')]
# -> ['a', 'b']
# or -> ['b', 'a']

Credits

This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.