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

2017-09-07 Thread Ben Bacarisse
Chris Angelico writes: > On Thu, Sep 7, 2017 at 5:59 PM, Marko Rauhamaa wrote: >> 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 +

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

2017-09-07 Thread Chris Angelico
On Thu, Sep 7, 2017 at 5:59 PM, Marko Rauhamaa wrote: > 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

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 immediately comes up with a "wrong" answer.

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

2017-09-06 Thread Steve D'Aprano
On Thu, 7 Sep 2017 01:31 am, Ian Kelly wrote: > On Wed, Sep 6, 2017 at 1:37 AM, Marko Rauhamaa wrote: >> >> 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 immediately comes up with a "wrong" a

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

2017-09-06 Thread Steve D'Aprano
On Wed, 6 Sep 2017 11:08 pm, Rustom Mody wrote: > On Wednesday, September 6, 2017 at 5:59:17 PM UTC+5:30, nopsidy wrote: >> https://www.youtube.com/watch?v= [...] >> Thank you, >> -Alex Goretoy >> [...] Please don't quote nopsidy's spam. He is spamming the list with multiple links to the same v

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

2017-09-06 Thread Ben Bacarisse
Rustom Mody writes: > I posted it because I genuinely thought I had missed some obvious way > of splitting a set into an (arbitrary) element and a rest without > jumping through hoops. Evidently not Curious, because I posted because I thought you had. Anyway, for speed you probably just want

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

2017-09-06 Thread Ben Bacarisse
Gregory Ewing writes: > 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. Yes, but my intent was to show that the pat

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

2017-09-06 Thread Tony van der Hoff
On 06/09/17 16:31, Ian Kelly wrote: > On Wed, Sep 6, 2017 at 1:37 AM, Marko Rauhamaa wrote: >> 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 immediately comes up with a "wrong" answer. > There

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

2017-09-06 Thread Ian Kelly
On Wed, Sep 6, 2017 at 1:37 AM, Marko Rauhamaa wrote: > > 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 immediately comes up with a "wrong" answer. There are no "wrong" answers with these kinds of p

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

2017-09-06 Thread Rustom Mody
On Wednesday, September 6, 2017 at 5:59:17 PM UTC+5:30, nopsidy wrote: > https://www.youtube.com/watch?v=pNe1wWeaHOU&list=PLYI8318YYdkCsZ7dsYV01n6TZhXA6Wf9i&index=1 > Thank you, > -Alex Goretoy > http://launchpad.net/~a1g You (Alex) are top-posting. I am not fussy. But others here can be In any ca

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

2017-09-06 Thread nopsidy
https://www.youtube.com/watch?v=pNe1wWeaHOU&list=PLYI8318YYdkCsZ7dsYV01n6TZhXA6Wf9i&index=1 Thank you, -Alex Goretoy http://launchpad.net/~a1g On Wed, Sep 6, 2017 at 7:22 PM, Stefan Ram wrote: > Rustom Mody writes: >>Because the abstract idea of a permutation is a list (sequence) > > Traditio

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

2017-09-06 Thread Rustom Mody
On Wednesday, September 6, 2017 at 4:29:56 PM UTC+5:30, Gregory Ewing wrote: > 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

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 terms only to the extent tha

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 inve

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

2017-09-05 Thread Steven D'Aprano
On Wed, 06 Sep 2017 01:31:56 +, Stefan Ram wrote: > Steve D'Aprano writes: >>On Wed, 6 Sep 2017 12:19 am, Rustom Mody wrote: >>>And how do you write even the simplest assignment statement without a >>>(mathematical) expression on the rhs? >>name = other_name is not a mathematical expression.

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

2017-09-05 Thread Steven D'Aprano
On Tue, 05 Sep 2017 18:28:02 -0700, Rustom Mody wrote: > On Wednesday, September 6, 2017 at 6:27:24 AM UTC+5:30, Steve D'Aprano > wrote: >> On Wed, 6 Sep 2017 12:19 am, Rustom Mody wrote: >> >> > And how do you write even the simplest assignment statement without a >> > (mathematical) expression

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

2017-09-05 Thread Rustom Mody
On Wednesday, September 6, 2017 at 6:58:29 AM UTC+5:30, Rustom Mody wrote: > On Wednesday, September 6, 2017 at 6:27:24 AM UTC+5:30, Steve D'Aprano wrote: > > On Wed, 6 Sep 2017 12:19 am, Rustom Mody wrote: > > > What were Turing, Church, von Neumann, even Knuth by training? > > > Mathematicians >

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

2017-09-05 Thread 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. In one trivial sense that is true. Anyone can define any term to mean whatever they like. This is a perfectly sherbert thing to do. In a

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

2017-09-05 Thread Rustom Mody
On Wednesday, September 6, 2017 at 6:27:24 AM UTC+5:30, Steve D'Aprano wrote: > On Wed, 6 Sep 2017 12:19 am, Rustom Mody wrote: > > > And how do you write even the simplest assignment statement without a > > (mathematical) expression on the rhs? > > name = other_name > > is not a mathematical ex

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

2017-09-05 Thread Steve D'Aprano
On Wed, 6 Sep 2017 12:19 am, Rustom Mody wrote: > And how do you write even the simplest assignment statement without a > (mathematical) expression on the rhs? name = other_name is not a mathematical expression. Its giving something a new name. name = obj.attribute is not a mathematical expres

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 mathematicians call 'not cl

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 ar

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

2017-09-05 Thread Chris Angelico
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 are not really pleasant for > math-work Funnily enough, Python has never boasted tha

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 ba

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

2017-09-05 Thread Ben Bacarisse
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 basic problem is of generating combinations >> >> > Now thats neat as far as it goes but com

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 set

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 are fundamentally sets >

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 tried translating it to p

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)