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.1.tar.gz (3.8 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.1-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ksiterate-1.1.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for ksiterate-1.1.tar.gz
Algorithm Hash digest
SHA256 2e515aa1776b23418ef46fccb330183c12d4fc133df96dc5e104231d5bf514dd
MD5 31a34d20eb765fb4e2fe68d96cc4df09
BLAKE2b-256 3d98b9a09a86d8636ee44bf1d8a80d6785d3a4dd97b6bcbc76351bb08746ecd3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ksiterate-1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.8.10

File hashes

Hashes for ksiterate-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 46ad8a06a60d083292f94bc3f7ee917b3ab8b10ba7e0980fcefa7c422d65bf66
MD5 5467679055031cfb16f8b5061fb40ffd
BLAKE2b-256 f86adb2b2fa7b7da90f8429beabadf1cbd7fd5713109c99c46c1f492fe590a5a

See more details on using hashes here.

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