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


Groups > comp.lang.python > #19137

Re: "+=" does not work correct all alogn

From Olive <diolu@bigfoot.com>
Newsgroups comp.lang.python
Subject Re: "+=" does not work correct all alogn
Date 2012-01-19 19:19 +0100
Organization Aioe.org NNTP Server
Message-ID <20120119191950.7b908eee@bigfoot.com> (permalink)
References <mailman.4841.1326905342.27778.python-list@python.org>

Show all headers | View raw


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
 

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

"+="  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

csiph-web