Pre-release
This release is a pre-release and may not be stable for production use.
intersperse
A simple Python generator that yields elements from an iterable, inserting a separator value between each element.
Installation
pip install intersperse
Usage
# coding=utf-8
from intersperse import intersperse
# Intersperse zeros between numbers
print(list(intersperse([1, 2, 3], 0)))
# Output: [1, 0, 2, 0, 3]
# Works with any iterable
print(list(intersperse('abc', '-')))
# Output: ['a', '-', 'b', '-', 'c']
# Edge cases
print(list(intersperse([], 0)))
# Output: []
print(list(intersperse([1], 0)))
# Output: [1]
License
MIT
Release files for intersperse 0.1.0a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| intersperse-0.1.0a0.tar.gz | 2.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| intersperse-0.1.0a0-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 5.8 kB
Release files / intersperse-0.1.0a0.tar.gz
| Download URL | intersperse-0.1.0a0.tar.gz |
|---|---|
| Size | 2.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36145defb359017323111aad1401b909227c186b9d6b9ff6b6394db9f7a29e2d
|
|
BLAKE2b-256 checksum How to use checksums |
16c7f53ebb5a1dd3984e0d17911ae7cb7e8f17c6ca23410a7d5d752597c25676
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|
Release files / intersperse-0.1.0a0-py2.py3-none-any.whl
| Download URL | intersperse-0.1.0a0-py2.py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
d5a288f260bae0660c848c5cc423283af3832f5d0d3b0cea205fc1d15adc9cd1
|
|
BLAKE2b-256 checksum How to use checksums |
e8da7e3c4eef76d0c6da31449f7ce890f52b8a03bf76382cc68cf80009ae7e2f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.2
|