Please improve these comprehensions (was meaning of [ ])

breamoreboy at gmail.com breamoreboy at gmail.com
Mon Sep 4 17:44:56 EDT 2017


On Monday, September 4, 2017 at 9:14:24 PM UTC+1, Ben Bacarisse wrote:
> Rustom Mody <rustompmody at gmail.com> writes:
> 
> > Here is some code I (tried) to write in class the other day
> >
> > The basic problem is of generating combinations
> <snip>
> > Now thats neat as far as it goes but combinations are fundamentally sets
> > not lists
> >
> > So I thought python would do a better job
> > I tried translating it to python and sets but it turned out more annoying than
> > helpful
> > Can someone improve it??
> >

[lots of code snipped]

> -- 
> Ben.

Here's my take https://docs.python.org/3/library/itertools.html#itertools.combinations

Kindest regards.

Mark Lawrence.



More information about the Python-list mailing list