Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
always_iterable
✓ from jaraco.itertools import always_iterable
✗ from jaraco.itertools import always_iterable
No common mistake; always use the correct import.
collate
✓ from jaraco.itertools import collate
✗ from itertools import collate
Collate is not in stdlib itertools; must be imported from jaraco.itertools.
padnone
✓ from jaraco.itertools import padnone
✗ from itertools import padnone
padnone is a recipe from itertools docs but not in stdlib; jaraco provides it.
Demonstrates basic usage of always_iterable and collate.
from jaraco.itertools import always_iterable, collate
# Example usage
items = always_iterable([1, 2]) # returns iterable unchanged
items2 = always_iterable(1) # wraps int in a list
print(list(items))
print(list(items2))
# Collate multiple iterables
for x in collate([1, 3, 5], [2, 4, 6], key=lambda x: x):
print(x)
Errors
Common errors & fixes
ImportError: No module named jaraco.itertools
The package is installed but Python cannot find the module; likely installed in a different environment or the package name is jaraco-itertools (pip) while import is jaraco.itertools.
fixVerify install: `pip list | grep jaraco`. Import as `import jaraco.itertools` (not `import jaraco_itertools`).
AttributeError: module 'jaraco.itertools' has no attribute 'always_iterable'
An older version of jaraco.itertools may not have always_iterable, or the function was renamed/removed.
fixUpgrade to latest version: `pip install --upgrade jaraco-itertools`. Check available functions in documentation.
TypeError: 'NoneType' object is not iterable
Passing None to a function that expects an iterable (e.g., always_iterable(None) will yield an empty iterator, not error). If using other functions, they may not handle None.
fixUse always_iterable to wrap potential None values. For other functions, handle None before calling.
Upgrade
Version history
6.4.3latest on PyPI · released May 10, 2025
Audit
Dependencies
more-itertoolsrequiredUsed internally for some utility functions