Simple Go lang iota pattern implementation
Project description
PyIota - Simple Go lang iota pattern implementation
Simple Usage
from pyiota import iota
with iota.start():
A = iota()
B = iota()
C = iota()
with iota.start(10):
D = iota()
E = iota()
F = iota()
print(A, B, C, D, E, F) #=> '0 1 2 10 11 12'
How it works?
- Default
iota._counter
value equals to-1
. A = iota()
-iota.__new__()
incrementsiota._counter
and returns it.- It is possible to reset
iota._counter
callingiota()
withinwith iota.start(): ...
block.
2.1. You can also provide a number to start from. For example:D
,E
andF
from example above will be equal to10
,11
, and12
accrordingly.
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
pyiota-1.2.1-py3-none-any.whl
(2.5 kB
view hashes)