Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19093 > unrolled thread

"+=" does not work correct all alogn

Started byWilfried Falk <w_h_falk@yahoo.de>
First post2012-01-18 09:52 +0000
Last post2012-01-19 19:19 +0100
Articles 2 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  "+="  does not work correct all alogn Wilfried Falk <w_h_falk@yahoo.de> - 2012-01-18 09:52 +0000
    Re: "+="  does not work correct all alogn Olive <diolu@bigfoot.com> - 2012-01-19 19:19 +0100

#19093 — "+=" does not work correct all alogn

FromWilfried Falk <w_h_falk@yahoo.de>
Date2012-01-18 09:52 +0000
Subject"+=" does not work correct all alogn
Message-ID<mailman.4841.1326905342.27778.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

Hello Pythons,
 
attached to this email is a pdf-file which shows, that  "+=" does not work well all along. Mybe somebody of you is able to explain my observations in this respect. I will be glad about an answer.
 
Best regards
Wilfried

[toc] | [next] | [standalone]


#19137

FromOlive <diolu@bigfoot.com>
Date2012-01-19 19:19 +0100
Message-ID<20120119191950.7b908eee@bigfoot.com>
In reply to#19093
On Wed, 18 Jan 2012 09:52:55 +0000 (GMT)
Wilfried Falk <w_h_falk@yahoo.de> wrote:

> Hello Pythons,
>  
> attached to this email is a pdf-file which shows, that  "+=" does not
> work well all along. Mybe somebody of you is able to explain my
> observations in this respect. I will be glad about an answer. Best
> regards Wilfried

I am not sure I understand your first question. For the second this is
explained here:
http://docs.python.org/tutorial/controlflow.html#default-argument-values

In the first case, you create a new list from the empty list at each
call. In the second case, you modify the argument in place and it is
not reevaluated between calls.

Olive
 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web