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);
```python
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:
```python
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.0.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.0-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: ksiterate-1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 a75aec669f3b1ed1621d3ee59271991237aa5fb2e9a997607698d1dea12711e9
MD5 68d8f07420a9f8850ee3a65e68207579
BLAKE2b-256 906e70420323ea03bf069f728e8f425995716050b9009727b76243a7c2291508

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ksiterate-1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 195ba3bce3fd335104817ab321e15623a8a6ccc9b3c8487d15dc9e3714871496
MD5 df022604b81089801fa7dc5d4a23ab7b
BLAKE2b-256 fad4b207ea8b684230eb40a0600cbca73cfe8e8246186f6f0cf2a8181535ddd7

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