Each item of a list against all others
Project description
Each item of a list against all others
$pip install all-against-all
from all_against_all import all_against_all
import operator
list_ = [1, 2, 3, 4]
e = all_against_all(
func=operator.add, iterable=list_, ignore_exceptions=True, skip_own=True
)
e = list(e)
for ee in e:
print(ee)
# [((1, 2), 3), ((1, 3), 4), ((1, 4), 5)]
# [((2, 1), 3), ((2, 3), 5), ((2, 4), 6)]
# [((3, 1), 4), ((3, 2), 5), ((3, 4), 7)]
# [((4, 1), 5), ((4, 2), 6), ((4, 3), 7)]
e = all_against_all(
func=operator.add, iterable=list_, ignore_exceptions=True, skip_own=False
)
e = list(e)
for ee in e:
print(ee)
# [((1, 2), 3), ((1, 3), 4), ((1, 4), 5)]
# [((2, 1), 3), ((2, 3), 5), ((2, 4), 6)]
# [((3, 1), 4), ((3, 2), 5), ((3, 4), 7)]
# [((4, 1), 5), ((4, 2), 6), ((4, 3), 7)]
# [((1, 1), 2), ((1, 2), 3), ((1, 3), 4), ((1, 4), 5)]
# [((2, 1), 3), ((2, 2), 4), ((2, 3), 5), ((2, 4), 6)]
# [((3, 1), 4), ((3, 2), 5), ((3, 3), 6), ((3, 4), 7)]
# [((4, 1), 5), ((4, 2), 6), ((4, 3), 7), ((4, 4), 8)]
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 Distribution
all_against_all-0.10.tar.gz
(3.3 kB
view hashes)
Built Distribution
Close
Hashes for all_against_all-0.10-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ee482b0f1c69d2caf6597d370cc3ef07b78c4fcb2a243938bc9ab03f9589168 |
|
MD5 | fbee55aef9cb24d677c51fda3fb854bc |
|
BLAKE2b-256 | 379fa63042944d1d757086ab2bab4f7031d3618db980416be8d35a22e4b9ad59 |