Skip to main content

Module for iteration over product of given parameter values

Project description

ksiterate

Python module for iteration over product of given parameter values

Description

This library provides a class Iteration, which implements iteration over a product of given parameters.

Example 1:

itspec = [
	{
		'A':[1, 2, 3],
		'B':[10, 11, 12],
		'C':[20, 21]
	},
	];


it = ksiterate.Iteration(itspec);

for i in it.iterate():
	print(i);

This code ireates over every possible combination of values defined for parameters A, B anc C: (1, 10, 20), (1, 10, 21), (1, 11, 20), ...

It is also possible to split the iteration into inner/outer loops:

for i in it.iterate(include_params={"C",}):
	print(i);
	for j in it.iterate(i,):
		print(j);

This code iterates over C in the outer loop and over the rest of parameters in the inner loop.

Multiple parameter specifications may be included:

itspec = [
	{
		'A':[1, 2, 3],
		'B':[10, 11, 12],
		'C':[20, 21]
	},
	{
		'A':[5, 6,],
		'B':[10, 11],
		'C':[22, 23]
	}
	];


it = ksiterate.Iteration(itspec);

for i in it.iterate():
	print(i);

In this case, the iteration would account for sum of two products of combinations from first dictionary and from second dictionary.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ksiterate-1.2.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ksiterate-1.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file ksiterate-1.2.tar.gz.

File metadata

  • Download URL: ksiterate-1.2.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ksiterate-1.2.tar.gz
Algorithm Hash digest
SHA256 8f108430e6b7ab18057f95a77b17fe4d3f160b03e0bac77e27f139c340d076b0
MD5 973590ec6a3bd46ff03fa9d5990aaf56
BLAKE2b-256 386cf08f1c20d2c9fb8a7c371f8998460276ea7eacaa03eec301bd04cba5f52d

See more details on using hashes here.

Provenance

The following attestation bundles were made for ksiterate-1.2.tar.gz:

Publisher: publish.yml on ghkonrad/ksiterate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ksiterate-1.2-py3-none-any.whl.

File metadata

  • Download URL: ksiterate-1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ksiterate-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 722275f06772964d7123fdc2ea47d63e0beae17fafc81c875166dbee54710bc1
MD5 e128354661f7573bc24d288c13240dfe
BLAKE2b-256 f4f877d4e64bd585490b51f2ee227eef1844e8a8cb61a250bc5f7fe5ac3c6235

See more details on using hashes here.

Provenance

The following attestation bundles were made for ksiterate-1.2-py3-none-any.whl:

Publisher: publish.yml on ghkonrad/ksiterate

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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