Re: Please improve these comprehensions (was meaning of [ ])

2017-09-07 Thread Marko Rauhamaa
Dennis Lee Bieber : > On Wed, 06 Sep 2017 10:37:42 +0300, Marko Rauhamaa > declaimed the following: > >> >>Which reminds me of this puzzle I saw a couple of days ago: >> >> 1 + 4 = 5 >> 2 + 5 = 12 >> 3 + 6 = 21 >> 8 + 11 = ? >> >>A mathematician

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-06 Thread Gregory Ewing
Seems to me you're making life difficult for yourself (and very inefficient) by insisting on doing the whole computation with sets. If you want a set as a result, it's easy enough to construct one from the list at the end. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-06 Thread Marko Rauhamaa
Ben Finney : > r...@zedat.fu-berlin.de (Stefan Ram) writes: > >> In mathematics, every author is free to give his own definitions to >> concepts and create his own notation. > > [...] > > For established terms in the field, an author has freedom to redefine > those

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Steven D'Aprano
On Tue, 05 Sep 2017 19:07:32 -0700, Rustom Mody wrote: > Also noteworthy here: You know more about list comprehensions than their > inventor — Greg Ewing And many people know more about General Relativity than Albert Einstein. What's your point? > [No I normally would not call Greg their

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Chris Angelico
On Wed, Sep 6, 2017 at 12:19 AM, Rustom Mody wrote: > On Tuesday, September 5, 2017 at 7:32:52 PM UTC+5:30, Chris Angelico wrote: >> On Tue, Sep 5, 2017 at 11:49 PM, Rustom Mody wrote: >> > Pop et al wont work with frozen sets >> > Containment wont work with sets — what

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Rustom Mody
On Tuesday, September 5, 2017 at 7:32:52 PM UTC+5:30, Chris Angelico wrote: > On Tue, Sep 5, 2017 at 11:49 PM, Rustom Mody wrote: > > Pop et al wont work with frozen sets > > Containment wont work with sets — what mathematicians call 'not closed' > > All of which amounts to this that python sets

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-05 Thread Rustom Mody
On Tuesday, September 5, 2017 at 6:59:11 PM UTC+5:30, Ben Bacarisse wrote: > Rustom Mody writes: > > > On Tuesday, September 5, 2017 at 1:44:24 AM UTC+5:30, Ben Bacarisse wrote: > >> Rustom Mody writes: > >> > >> > Here is some code I (tried) to write in class the other day > >> > > >> > The

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-04 Thread Rustom Mody
On Tuesday, September 5, 2017 at 1:44:24 AM UTC+5:30, Ben Bacarisse wrote: > Rustom Mody writes: > > > Here is some code I (tried) to write in class the other day > > > > The basic problem is of generating combinations > > > Now thats neat as far as it goes but combinations are fundamentally

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-04 Thread breamoreboy
On Monday, September 4, 2017 at 9:14:24 PM UTC+1, Ben Bacarisse wrote: > Rustom Mody writes: > > > Here is some code I (tried) to write in class the other day > > > > The basic problem is of generating combinations > > > Now thats neat as far as it goes but combinations

Re: Please improve these comprehensions (was meaning of [ ])

2017-09-04 Thread Ben Bacarisse
Rustom Mody writes: > Here is some code I (tried) to write in class the other day > > The basic problem is of generating combinations > 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

Please improve these comprehensions (was meaning of [ ])

2017-09-04 Thread Rustom Mody
Since these discussions are uselessly abstract and meta Here is some code I (tried) to write in class the other day The basic problem is of generating combinations Using the pascal-identity nCr + nC(r-1) = (n+1)Cr This can be written (Haskell) c :: Int -> Int -> Int c n 0 = 1 c 0 (r+1)