Skip to main content

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?

  1. Default iota._counter value equals to -1.
  2. A = iota() - iota.__new__() increments iota._counter and returns it.
  3. It is possible to reset iota._counter calling iota() within with iota.start(): ... block.
    2.1. You can also provide a number to start from. For example: D, E and F from example above will be equal to 10, 11, and 12 accrordingly.

Project details


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)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page