Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread HenHanna via Python-list
n... How can this code work??? , when it's > def chunk1(seq): and it's [s] within the def-body ? it seemed as if the Compiler was doing a DWIM (Do what i mean) trick. On 09/06/2024 22:20, HenHanna via Python-list wr

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread AVI GROSS via Python-list
#x27;, 'c', 'c'], ['singleton']] >>> chunkC([1, 2, 2, 'c', 'c', 'c', 'singleton']) [[1, 1], [2, 2], ['c', 3], ['singleton', 1]] # COMMENTS The current version has flaws I have not bothered correcting. Jus

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-11 Thread Rob Cliffe via Python-list
## Program output: ['aaa', 'bb', '', 'aa'] [('a', 3), ('b', 2), ('c', 4), ('a', 2)] Rob Cliffe On 09/06/2024 22:20, HenHanna via Python-list wrote: Chunk, ChunkC -- nice simple way(s) to write these in Python? (Ch

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread AVI GROSS via Python-list
What does it mean for items in a row to be equal? If I have a sublist, should I unlist to make it flat first, or should it be an error, or should each such sublist be compared for full equality or even relative equality so that (a (b c) (c b) d) actually accepts (b c) and (c b) as the same for the

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread HenHanna via Python-list
:20 PM To: python-list@python.org Subject: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3)) Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk '(a a ba a a b b)) ==> ((a a) (b) (a a a) (b b)) (Chunk '(a a a a b c

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-10 Thread HenHanna via Python-list
On 6/9/2024 3:50 PM, MRAB wrote: On 2024-06-09 22:20, HenHanna via Python-list wrote: Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk  '(a a   b    a a a   b b))   ==> ((a a) (b)  (a a a) (b b)) (Chunk  '(a a a a   b   c c   a a   d   e e e e))  

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread AVI GROSS via Python-list
? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3)) Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk '(a a ba a a b b)) ==> ((a a) (b) (a a a) (b b)) (Chunk '(a a a a b c c a a d e e e e)) ==> ((a a a a) (b)

RE: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread AVI GROSS via Python-list
would be trivial, perhaps leveraging the above. -Original Message- From: Python-list On Behalf Of HenHanna via Python-list Sent: Sunday, June 9, 2024 5:20 PM To: python-list@python.org Subject: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3)) Chunk, ChunkC -- nice si

Re: in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread MRAB via Python-list
On 2024-06-09 22:20, HenHanna via Python-list wrote: Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk '(a a b a a a b b)) ==> ((a a) (b) (a a a) (b b)) (Chunk '(a a a a b c c a a d e e e e)) ==> ((a a a a) (b) (c c) (a

in Python? -- Chunk -- (ChunkC '(a a b b b)), ==> ((a 2) (b 3))

2024-06-09 Thread HenHanna via Python-list
Chunk, ChunkC -- nice simple way(s) to write these in Python? (Chunk '(a a b a a a b b)) ==> ((a a) (b) (a a a) (b b)) (Chunk '(a a a a b c c a a d e e e e)) ==> ((a a a a) (b) (c c) (a a) (d) (e e e e)) (Chunk '(2 2 foo bar bar

Re: one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-27 Thread Greg Ewing via Python-list
On 28/02/23 4:24 pm, Hen Hanna wrote: is it poss. to peek at the Python-list's messages without joining ? It's mirrored to the comp.lang.python usenet group, or you can read it through gmane with a news client. -- Greg -- https://mail.python.org/mailman/listinfo/py

RE: one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-26 Thread avi.e.gross
t;> print(p2b(nested)) (1, 2, (3, 4, (5, 6, 7), 8), 9) People who speak python well do not necessarily lisp. -Original Message- From: Python-list On Behalf Of Hen Hanna Sent: Sunday, February 26, 2023 4:54 AM To: python-list@python.org Subject: Re: one Liner: Lisprint(x) --> (a,

Re: one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-26 Thread Hen Hanna
On Saturday, February 25, 2023 at 11:45:12 PM UTC-8, Hen Hanna wrote: > def Lisprint(x): print( ' (' + ', '.join(x) + ')' , '\n') > > a= ' a b c ? def f x if zero? x 0 1 ' > a += ' A B C ! just an example ' > x= a.spli

one Liner: Lisprint(x) --> (a, b, c) instead of ['a', 'b', 'c']

2023-02-26 Thread Hen Hanna
def Lisprint(x): print( ' (' + ', '.join(x) + ')' , '\n') a=' a b c ? def f x if zero? x 0 1 ' a += ' A B C ! just an example ' x= a.split() print(x) Lisprint(x) ['a', 'b', 'c', '?',

Re: a &= b

2019-10-04 Thread David
On Fri, 4 Oct 2019 at 19:02, Hongyi Zhao wrote: > > Could you please give me some more hints on: > > a &= b $ python3 Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on linux Type "help", "copyright", "credits" or "license&qu

Re: a &= b

2019-10-04 Thread Joel Goldstick
On Fri, Oct 4, 2019 at 5:01 AM Hongyi Zhao wrote: > > Hi, > > Could you please give me some more hints on: > > a &= b > > It's very difficult for me to understand. > -- > https://mail.python.org/mailman/listinfo/python-list & is bitwise And. a

a &= b

2019-10-04 Thread Hongyi Zhao
Hi, Could you please give me some more hints on: a &= b It's very difficult for me to understand. -- https://mail.python.org/mailman/listinfo/python-list

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Serhiy Storchaka
side effect of moving the optimization for `x in [a, b]` from the peepholer to the AST optimizer. Ah ha. Thank you. Is it worth trying to reinstate that? On the one hand, there's no reason to build the list, and this technically is a (performance) regression. On the other hand, it's

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Chris Angelico
his was a side effect of moving the optimization for `x in [a, b]` from > the peepholer to the AST optimizer. > Ah ha. Thank you. Is it worth trying to reinstate that? On the one hand, there's no reason to build the list, and this technically is a (performance) regression. On the other hand,

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-03 Thread Serhiy Storchaka
02.09.19 12:24, Chris Angelico пише: But the curious difference happens in 3.7. I don't know what changed to cause this, but from there on, the list gets built and then unpacked. This was a side effect of moving the optimization for `x in [a, b]` from the peepholer to the AST opti

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Eko palypse
Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao: > Hi, > > What's differences: > > a,b = 2,3 and [a,b] = [2,3] > > Regards In this example the result is the same but the second one builds, internally, an additional list, therefore isn't as suffici

a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Hongyi Zhao
Hi, What's differences: a,b = 2,3 and [a,b] = [2,3] Regards -- https://mail.python.org/mailman/listinfo/python-list

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Chris Angelico
gt; tried again: > > bash-4.2$ python3 -E > Python 3.6.6 (default, Aug 13 2018, 18:24:23) > [GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> def f(): > ...

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-02 Thread Alan Bawden
Chris Angelico writes: > On Mon, Sep 2, 2019 at 12:36 PM Alan Bawden wrote: ... > > > > a,b = 2,3 and [a,b] = [2,3] ... > > It looks to me like they generate identical code. The first one calls the > > construction of a tuple, where the second one calls for the cons

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-01 Thread Chris Angelico
On Mon, Sep 2, 2019 at 12:36 PM Alan Bawden wrote: > > Eko palypse writes: > > > Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao: > > > Hi, > > > > > > What's differences: > > > > > > a,b = 2,3 and [a,b] = [2,3] &

Re: a,b = 2,3 and [a,b] = [2,3]

2019-09-01 Thread Alan Bawden
Eko palypse writes: > Am Montag, 2. September 2019 00:49:05 UTC+2 schrieb Hongyi Zhao: > > Hi, > > > > What's differences: > > > > a,b = 2,3 and [a,b] = [2,3] > > > > Regards > > In this example the result is the same but the second

Re: What is a, b, c, and d in: rect1 = drawing.create_rectangle(a, b, c, d) and circle1 = drawing.create_oval(a, b, c, d)

2019-04-09 Thread Terry Reedy
On 4/9/2019 4:24 PM, Christian Gollwitzer wrote: Am 09.04.19 um 21:57 schrieb CrazyVideoGamez: What is a, b, c, and d in: from tkinter import * window = Tk() drawing = Canvas(window, height=500, width=500) rectangle = drawing.create_rectangle(a, b, c, d) and: circle = drawing.create_oval(a, b

Re: What is a, b, c, and d in: rect1 = drawing.create_rectangle(a, b, c, d) and circle1 = drawing.create_oval(a, b, c, d)

2019-04-09 Thread Peter Otten
CrazyVideoGamez wrote: > What is a, b, c, and d in: > from tkinter import * > window = Tk() > drawing = Canvas(window, height=500, width=500) > rectangle = drawing.create_rectangle(a, b, c, d) > and: > circle = drawing.create_oval(a, b, c, d) > ??? Here's a picture:

What is a, b, c, and d in: rect1 = drawing.create_rectangle(a, b, c, d) and circle1 = drawing.create_oval(a, b, c, d)

2019-04-09 Thread CrazyVideoGamez
What is a, b, c, and d in: from tkinter import * window = Tk() drawing = Canvas(window, height=500, width=500) rectangle = drawing.create_rectangle(a, b, c, d) and: circle = drawing.create_oval(a, b, c, d) ??? -- https://mail.python.org/mailman/listinfo/python-list

Re: What is a, b, c, and d in: rect1 = drawing.create_rectangle(a, b, c, d) and circle1 = drawing.create_oval(a, b, c, d)

2019-04-09 Thread Christian Gollwitzer
Am 09.04.19 um 21:57 schrieb CrazyVideoGamez: What is a, b, c, and d in: from tkinter import * window = Tk() drawing = Canvas(window, height=500, width=500) rectangle = drawing.create_rectangle(a, b, c, d) and: circle = drawing.create_oval(a, b, c, d) ??? Look it up in the original Tk

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Chris Angelico
On Fri, Aug 26, 2016 at 8:20 PM, mlz wrote: > I believe there are languages that preserve exact accuracy in this way for > rational fractions. I don't know if Python is one of them. It is, but only if you explicitly request it (due to the performance impact). Just import it: #!/usr/bin/python2

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Jussi Piitulainen
mlz writes: > It's true that a*(b/c) yields fractions which would probably accrue > accuracy errors depending on how those values are implemented. For > example, it is possible to represent 1/3 internally as two numbers, > numerator and denominator, thus avoiding the repe

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread mlz
It's true that a*(b/c) yields fractions which would probably accrue accuracy errors depending on how those values are implemented. For example, it is possible to represent 1/3 internally as two numbers, numerator and denominator, thus avoiding the repeating decimal (or binimal, or whatever

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread mlz
Partly it's the layout, but mathematically speaking the two should be equal. (a*b)/c should equal a*(b/c) The fact that they're not is surprising, because python 2 so seamlessly supports big integers in a mathematically correct way. I consider such surprising behavior to be abstra

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread mlz
Aha. That's interesting. On Friday, August 26, 2016 at 2:11:32 AM UTC-7, Peter Otten wrote: > mlz wrote: > > > Yes, I just worked that out. It's the integer math that's the problem. > > > > I guess this has been fixed in python 3, but unfortunately it seems that > > most people are still using

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread BartC
On 26/08/2016 08:14, mlzarathus...@gmail.com wrote: However, precedence wasn't the problem in this case, it was the type conversion. I think it was. I was puzzled as well. But apparently if you have: x * = expr That's like: x = x * (expr)# note the parentheses which may not al

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Peter Otten
mlzarathus...@gmail.com wrote: > Yes, I just worked that out. It's the integer math that's the problem. > > I guess this has been fixed in python 3, but unfortunately it seems that > most people are still using python 2. Note that you can get Python 3's default behaviour in Python 2 with from _

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Christian Gollwitzer
ow is this related to your question? The example explicitly says Python 2 and doesn't use the '//' operator. It's related by the fact that a*b/c performs integer division (intended by the OP) which gives a different result than a*(b/c) (unintended by the OP). Floating point (as

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Erik
On 26/08/16 08:14, mlzarathus...@gmail.com wrote: I was being facetious, but behind it is a serious point. Neither the APL nor the J languages use precedence even though their inventor, Ken Iverson, was a mathematician. That was to support functional programming dating back to the 1970's. P

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Erik
On 26/08/16 08:44, mlzarathus...@gmail.com wrote: Here's the key: $ python2 Python 2.7.10 ... 1/2 0 $ python Python 3.5.1 ... 1/2 0.5 1//2 0 I read about this awhile ago, but it's not until it bites you that you remember fully. How is this related to your question? The example e

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread mlzarathustra
Here's the key: $ python2 Python 2.7.10 ... >>> 1/2 0 >>> $ python Python 3.5.1 ... >>> 1/2 0.5 >>> 1//2 0 >>> I read about this awhile ago, but it's not until it bites you that you remember fully. -- https://mail.python.org/mailman/listinfo/python-list

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread Jussi Piitulainen
mlzarathus...@gmail.com writes: > Yes, I just worked that out. It's the integer math that's the problem. > > I guess this has been fixed in python 3 [- -] Note that division in Python 3 produces approximate results (floating point numbers). This may or may not be what you want in this exercise. I

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread mlzarathustra
I was being facetious, but behind it is a serious point. Neither the APL nor the J languages use precedence even though their inventor, Ken Iverson, was a mathematician. That was to support functional programming dating back to the 1970's. However, precedence wasn't the problem in this case, i

Re: a *= b not equivalent to a = a*b

2016-08-26 Thread mlzarathustra
Yes, I just worked that out. It's the integer math that's the problem. I guess this has been fixed in python 3, but unfortunately it seems that most people are still using python 2. Thanks for all the help! -- https://mail.python.org/mailman/listinfo/python-list

Re: a *= b not equivalent to a = a*b

2016-08-25 Thread Peter Otten
mple: >>> (2*2)/3 1 >>> 2*(2/3) 0 Now "hide" the the order of evaluation: >>> a, b = 2, 3 >>> a *= a/b >>> a 0 >>> a, b = 2, 3 >>> a = a*a/b >>> a 1 > return rs > > > for n in range(10):

Re: a *= b not equivalent to a = a*b

2016-08-25 Thread Chris Angelico
On Fri, Aug 26, 2016 at 4:40 PM, wrote: > Precedence, d'oh! > > rs *= (n-(i-1))/i > is equivalent to: > rs = rs * ((n-(i-1))/i) > > not > rs = rs * (n-(i-1))/i > > which is the same as > rs = ( rs * (n-(i-1)) ) /i > > > Ken Iverson was right. Precedence is a bad i

Re: a *= b not equivalent to a = a*b

2016-08-25 Thread mlzarathustra
Precedence, d'oh! rs *= (n-(i-1))/i is equivalent to: rs = rs * ((n-(i-1))/i) not rs = rs * (n-(i-1))/i which is the same as rs = ( rs * (n-(i-1)) ) /i Ken Iverson was right. Precedence is a bad idea. -- https://mail.python.org/mailman/listinfo/python

Re: a *= b not equivalent to a = a*b

2016-08-25 Thread INADA Naoki
if FAIL: rs *= (n-(i-1))/i # these should be the same, This is equal to rs = rs * ((n-(i-1))/i) else: rs = rs * (n-(i-1))/i # but apparently are not This is equal to rs = (rs * (n-(i-1)))/i On Fri, Aug 26, 2016 at 3:20 PM, mlz wrote: > I've been playing with the binomial f

Re: a *= b not equivalent to a = a*b

2016-08-25 Thread Jussi Piitulainen
mlz writes: > I've been playing with the binomial function, and found that in the > below code, rs *= x does not behave the same way as rs = rs * x. When > I set FAIL to True, I get a different result. Both results are below. > > I had read that the two were equivalent. What am I missing? You do

a *= b not equivalent to a = a*b

2016-08-25 Thread mlz
I've been playing with the binomial function, and found that in the below code, rs *= x does not behave the same way as rs = rs * x. When I set FAIL to True, I get a different result. Both results are below. I had read that the two were equivalent. What am I missing? thanks, -= miles =- #!

Re: Multiple Assignment a = b = c

2016-02-16 Thread Terry Reedy
On 2/16/2016 7:46 AM, srinivas devaki wrote: Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] https://docs.python.org/3/reference/simple_stmts.html#assignment-state

Re: Multiple Assignment a = b = c

2016-02-16 Thread srinivas devaki
On Tue, Feb 16, 2016 at 6:35 PM, Sven R. Kunze wrote: > > First, the rhs is evaluated. > Second, the lhs is evaluated from left to right. Great, I will remember these two lines :) On Tue, Feb 16, 2016 at 8:46 PM, Steven D'Aprano wrote: > _temp = c > a = _temp > b = _temp > del _temp > > > except

Re: Multiple Assignment a = b = c

2016-02-16 Thread Steven D'Aprano
On Tue, 16 Feb 2016 11:46 pm, srinivas devaki wrote: > Hi, > > a = b = c > > as an assignment doesn't return anything, i ruled out a = b = c as > chained assignment, like a = (b = c) > SO i thought, a = b = c is resolved as > a, b = [c, c] That is one way of think

Re: Multiple Assignment a = b = c

2016-02-16 Thread Sven R. Kunze
(as you suggested at the beginning). a,b=b,a=4,5 (a,b),(b,a)=(4,5),(4,5) Best, Sven -- https://mail.python.org/mailman/listinfo/python-list

Re: Multiple Assignment a = b = c

2016-02-16 Thread Sven R. Kunze
Hi Srinivas, On 16.02.2016 13:46, srinivas devaki wrote: Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] at-least i fixed in my mind that every assignment

Multiple Assignment a = b = c

2016-02-16 Thread srinivas devaki
Hi, a = b = c as an assignment doesn't return anything, i ruled out a = b = c as chained assignment, like a = (b = c) SO i thought, a = b = c is resolved as a, b = [c, c] at-least i fixed in my mind that every assignment like operation in python is done with references and then the refer

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-27 Thread Emile van Sebille
On 8/26/2015 2:14 PM, Grant Edwards wrote: On 2015-08-26, Emile van Sebille wrote: On 8/26/2015 9:06 AM, Grant Edwards wrote: It's also unfortunate that there's no way to to access the mailing list via an NNTP server Huh? -- gmane.comp.python.general at news://nntp.gmane.com:119/gmane.comp.p

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Ian Kelly
On Wed, Aug 26, 2015 at 12:11 PM, Andy Kubiak wrote: > What if you could send all your mail to another address on a server you > control, or can at least run programs on? That seems like a lot more hassle than it would be worth. -- https://mail.python.org/mailman/listinfo/python-list

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Grant Edwards
On 2015-08-26, Emile van Sebille wrote: > On 8/26/2015 9:06 AM, Grant Edwards wrote: >> It's also unfortunate that there's no way to >> to access the mailing list via an NNTP server > > Huh? -- gmane.comp.python.general at > news://nntp.gmane.com:119/gmane.comp.python.general > > Or do you mean by

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Emile van Sebille
On 8/26/2015 9:06 AM, Grant Edwards wrote: It's also unfortunate that there's no way to to access the mailing list via an NNTP server Huh? -- gmane.comp.python.general at news://nntp.gmane.com:119/gmane.comp.python.general Or do you mean by the OP? Emile -- https://mail.python.org/mailman/l

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Andy Kubiak
> > I wish I could, problem is, if the mail recipient is within the company, > no legal boilerplate is added making the joke fall flat. > What if you could send all your mail to another address on a server you control, or can at least run programs on? Could you configure all your outgoing mail to

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Jean-Michel Pichavant
- Original Message - > From: "Chris Angelico" > Cc: python-list@python.org > Sent: Wednesday, 26 August, 2015 6:11:51 PM > Subject: Re: Please don't make unfounded legalistic demands (was: [a, b, c, > d] = 1, 2, 3, 4) > > On Thu, Aug 27, 2015 at 1:

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Chris Angelico
On Thu, Aug 27, 2015 at 1:09 AM, Terry Reedy wrote: > How about instead you augment your signature with "Please ignore the > boilerplate below. Heh, I like this! Or: """ -- BOILERPLATE TROPHY COLLECTION I am a collector of stupid legal boilerplate. Here's my latest acquisition: """ Then let yo

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Grant Edwards
On 2015-08-26, Terry Reedy wrote: > On 8/26/2015 5:02 AM, Jean-Michel Pichavant wrote: >>> Misleading, intimidating, hostile nonsense. > > Agreed. > >>> If you want to participate here, please do so from a mail system > >> which does not make these legalistic demands. > > I disagree with prohibit

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Gene Heskett
On Wednesday 26 August 2015 11:09:18 Terry Reedy wrote: > On 8/26/2015 5:02 AM, Jean-Michel Pichavant wrote: > > - Original Message - > > > >> From: "Ben Finney" > >> > >>> The contents of this email and any attachments are confidential > >>> and may also be privileged. If you are not the

Re: [a,b,c,d] = 1,2,3,4

2015-08-26 Thread Terry Reedy
On 8/26/2015 8:21 AM, Tim Chase wrote: a, b, c = (x for x in range(3)) # a generator for instance Since range() *is* a generator, why not just use In Python 3, range is a sequence class with a separate iterator class >>> r = range(3) >>> r range(0, 3) >>> iter

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Terry Reedy
On 8/26/2015 5:02 AM, Jean-Michel Pichavant wrote: - Original Message - From: "Ben Finney" The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the con

Re: Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Jean-Michel Pichavant
- Original Message - > From: "Ben Finney" > > The contents of this email and any attachments are confidential and > > may also be privileged. If you are not the intended recipient, > > please > > notify the sender immediately and do not disclose the contents to > > any > > other person, us

Re: [a,b,c,d] = 1,2,3,4

2015-08-26 Thread Jean-Michel Pichavant
- Original Message - > From: "Chris Angelico" > Cc: python-list@python.org > Sent: Wednesday, 26 August, 2015 3:04:05 PM > Subject: Re: [a,b,c,d] = 1,2,3,4 > > On Wed, Aug 26, 2015 at 12:59 AM, Jean-Michel Pichavant > wrote: > > To add to Joel

Re: [a,b,c,d] = 1,2,3,4

2015-08-26 Thread Chris Angelico
On Wed, Aug 26, 2015 at 12:59 AM, Jean-Michel Pichavant wrote: > To add to Joel's answer, the right side can be *any* sequence, and is not > restricted to lists or tuples. > > a, b, c = (x for x in range(3)) # a generator for instance FWIW, a generator is not a sequence; this

Re: [a,b,c,d] = 1,2,3,4

2015-08-26 Thread Tim Chase
> >>> a > > (1, 2, 3) > > >>> a[1] > > 2 > > To add to Joel's answer, the right side can be *any* sequence, and > is not restricted to lists or tuples. > > a, b, c = (x for x in range(3)) # a generator for instance Since range() *

Please don't make unfounded legalistic demands (was: [a, b, c, d] = 1, 2, 3, 4)

2015-08-26 Thread Ben Finney
Jean-Michel Pichavant writes: > -- IMPORTANT NOTICE: > > The contents of this email and any attachments are confidential and > may also be privileged. If you are not the intended recipient, please > notify the sender immediately and do not disclose the contents to any > other person, use it for

Re: [a,b,c,d] = 1,2,3,4

2015-08-26 Thread Jean-Michel Pichavant
Joel's answer, the right side can be *any* sequence, and is not restricted to lists or tuples. a, b, c = (x for x in range(3)) # a generator for instance That would be a generator unpacking combined with a tuple packing (is packing restricted to tuples and lists ? probably) JM -- IMPORTANT NOTI

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Jussi Piitulainen
Ian Kelly writes: > On Tue, Aug 25, 2015 at 9:32 AM, Skip Montanaro wrote: >> On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen wrote: >>> >>> When I try it today, round brackets also work, both in 2.6.6 and >>> 3.4.0 - no idea what version it was where they failed or if I'm >>> imagining the who

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Jussi Piitulainen
Skip Montanaro writes: > On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen wrote: > >> When I try it today, round brackets also work, both in 2.6.6 and >> 3.4.0 - no idea what version it was where they failed or if I'm >> imagining the whole thing. > > You are imagining the whole thing. Either

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Ian Kelly
On Tue, Aug 25, 2015 at 9:32 AM, Skip Montanaro wrote: > > On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen > wrote: >> >> When I try it today, round brackets >> also work, both in 2.6.6 and 3.4.0 - no idea what version it was where >> they failed or if I'm imagining the whole thing. > > > You

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Skip Montanaro
On Tue, Aug 25, 2015 at 10:24 AM, Jussi Piitulainen < harvested.address@is.invalid> wrote: > When I try it today, round brackets > also work, both in 2.6.6 and 3.4.0 - no idea what version it was where > they failed or if I'm imagining the whole thing. > You are imagining the whole thing. Either

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Jussi Piitulainen
"ast" writes: >>>> [a,b,c,d] = 1,2,3,4 >>>> a > 1 >>>> b > 2 >>>> c > 3 >>>> d > 4 > > I have never seen this syntax before. Is it documented. > Is there a name for that ? I remember being unhappy when a

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread ast
"Joel Goldstick" a écrit dans le message de news:mailman.27.1440515128.11709.python-l...@python.org... On Tue, Aug 25, 2015 at 10:32 AM, Cody Piersall wrote: On Tue, Aug 25, 2015 at 9:16 AM, ast wrote: The original example is one I haven't seen in the wild. I found it using matplotl

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread ast
"ast" a écrit dans le message de news:55dc853c$0$3083$426a7...@news.free.fr... "Joel Goldstick" a écrit dans le message de news:mailman.23.1440513059.11709.python-l...@python.org... On Tue, Aug 25, 2015 at 10:16 AM, ast wrote: [a,b,c,d] = 1,2,3,4 a 1 b 2 c

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread ast
"Joel Goldstick" a écrit dans le message de news:mailman.23.1440513059.11709.python-l...@python.org... On Tue, Aug 25, 2015 at 10:16 AM, ast wrote: [a,b,c,d] = 1,2,3,4 a 1 b 2 c 3 d 4 I have never seen this syntax before. Is it documented. Is there a name for t

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Joel Goldstick
On Tue, Aug 25, 2015 at 10:32 AM, Cody Piersall wrote: > > > On Tue, Aug 25, 2015 at 9:16 AM, ast wrote: >>>>> >>>>> [a,b,c,d] = 1,2,3,4 >>>>> a >> >> 1 >>>>> >>>>> b >> >> 2 >>>

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Jean-Michel Pichavant
- Original Message - > From: "ast" > To: python-list@python.org > Sent: Tuesday, 25 August, 2015 4:16:17 PM > Subject: [a,b,c,d] = 1,2,3,4 > > >>> [a,b,c,d] = 1,2,3,4 > >>> a > 1 > >>> b > 2 > >>> c > 3 >

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Cody Piersall
On Tue, Aug 25, 2015 at 9:16 AM, ast wrote: > [a,b,c,d] = 1,2,3,4 >>>> a >>>> >>> 1 > >> b >>>> >>> 2 > >> c >>>> >>> 3 > >> d >>>> >>> 4 > > I have never seen th

Re: [a,b,c,d] = 1,2,3,4

2015-08-25 Thread Joel Goldstick
On Tue, Aug 25, 2015 at 10:16 AM, ast wrote: >>>> [a,b,c,d] = 1,2,3,4 >>>> a > > 1 >>>> >>>> b > > 2 >>>> >>>> c > > 3 >>>> >>>> d > > 4 > > I have never seen this syn

[a,b,c,d] = 1,2,3,4

2015-08-25 Thread ast
[a,b,c,d] = 1,2,3,4 a 1 b 2 c 3 d 4 I have never seen this syntax before. Is it documented. Is there a name for that ? thx -- https://mail.python.org/mailman/listinfo/python-list

Re: Question about 'x' in pymc.invlogit(a+b*x)

2015-03-07 Thread Terry Reedy
x27;) name alpha = pymc.Normal('alpha',mu=0,tau=.01) beta = pymc.Normal('beta',mu=0,tau=.01) @pymc.deterministic def theta(a=alpha, b=beta): """theta = logit^{-1}(a+b)""" return pymc.invlogit(a+b*x) x is used here. Names in functions

Question about 'x' in pymc.invlogit(a+b*x)

2015-03-07 Thread fl
a',mu=0,tau=.01) @pymc.deterministic def theta(a=alpha, b=beta): """theta = logit^{-1}(a+b)""" return pymc.invlogit(a+b*x) d = pymc.Binomial('d', n=n, p=theta, value=np.array([0.,1.,3.,5.]),\ observed=True) I don't understand t

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-10 Thread pete . bee . emm
7, length power wrote: > >>> x=["a","b",["c","d"],"e"] > >>> y=x[2] > >>> y > ['c', 'd'] > >>> x.insert(2,y[0]) > >>> x > > ['a', 'b', 'c&

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-10 Thread Boris Borcic
Boris Borcic wrote: Rustom Mody wrote: def fl1(l): return [y for x in l for y in x] # recursive flatten def fr(l): ... if not isinstance(l,list): return [l] ... return fl1([fr(x) for x in l]) For a short non-recursive procedure - not a function, modifies L in-place but none of its su

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-10 Thread Boris Borcic
Rustom Mody wrote: def fl1(l): return [y for x in l for y in x] # recursive flatten def fr(l): ... if not isinstance(l,list): return [l] ... return fl1([fr(x) for x in l]) For a short non-recursive procedure - not a function, modifies L in-place but none of its sublists. >>> def flat

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-09 Thread Rustom Mody
On Thursday, April 10, 2014 10:55:10 AM UTC+5:30, balaji marisetti wrote: > There was long thread discussing flattening of a list on this list :). > See the link below. I dont think that thread is relevant to this question: 1. That (started with) a strange/cute way of using names 2. It does not wo

Re: how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-09 Thread balaji marisetti
There was long thread discussing flattening of a list on this list :). See the link below. https://mail.python.org/pipermail/python-list/2014-March/669256.html On 10 April 2014 10:44, length power wrote: >>>> x=["a","b",["c","d"],"e"

Re: how to make ["a", "b", ["c", "d"], "e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-09 Thread Ben Finney
length power writes: > maybe there is a more smart way to do. Maybe. But a way to do what, exactly? You start with a list, but what is it exactly that you want to do with that list? >>> x = ["a", "b", ["c", "d"], "e"] If I in

how to make ["a","b",["c","d"],"e"] into ['a', 'b', 'c', 'd', 'e'] ?

2014-04-09 Thread length power
>>> x=["a","b",["c","d"],"e"] >>> y=x[2] >>> y ['c', 'd'] >>> x.insert(2,y[0]) >>> x ['a', 'b', 'c', ['c', 'd'], 'e'] >&

Re: what does 'a=b=c=[]' do

2011-12-25 Thread Steven D'Aprano
On Sat, 24 Dec 2011 19:41:55 +0100, Thomas Rachel wrote: >> The only times you need the brackets around a tuple is to control the >> precedence of operations, or for an empty tuple. > > IBTD: > > a=((a, b) for a, b, c in some_iter) > b=[(1, c) for ] > > Wi

Re: Early and late binding [was Re: what does 'a=b=c=[]' do]

2011-12-24 Thread Lie Ryan
On 12/24/2011 07:25 PM, Steven D'Aprano wrote: I'd use a function attribute. def func(x, y=None): if y is None: y = func.default_y ... func.default_y = [] That's awkward only if you believe function attributes are awkward. I do. All you've done is move the default from *before* the

Re: Early and late binding [was Re: what does 'a=b=c=[]' do]

2011-12-24 Thread rusi
On Dec 25, 5:32 am, Devin Jeanpierre wrote: > alex23 wrote: > > Because I believe that the source of confusion has far more to do with > > mutable/immutable objects than with early/late binding. Masking or > > 'correcting' an aspect of Python's behaviour because novices make the > > wrong assumpti

Re: Early and late binding [was Re: what does 'a=b=c=[]' do]

2011-12-24 Thread Devin Jeanpierre
> Because I believe that the source of confusion has far more to do with > mutable/immutable objects than with early/late binding. Masking or > 'correcting' an aspect of Python's behaviour because novices make the > wrong assumption about it just pushes the problem elsewhere and > potentially makes

Re: Early and late binding [was Re: what does 'a=b=c=[]' do]

2011-12-24 Thread alex23
On Dec 25, 9:25 am, Devin Jeanpierre wrote: > > If Python was ever 'fixed' to prevent this issue, I'm pretty sure we'd > > see an increase in the number of questions like the OP's. > > What makes you so sure? Both models do make sense and are equally > valid, it's just that only one of them is tru

  1   2   3   4   5   6   >