default value in __init__

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Thu Oct 16 06:05:40 CEST 2008


In message <01006451$0$20646$c3e8da3 at news.astraweb.com>, Steven D'Aprano
wrote:

> On Thu, 09 Oct 2008 01:39:30 -0700, kenneth (a.k.a. Paolo) wrote:
> 
>> On Oct 9, 10:14 am, Christian Heimes <li... at cheimes.de> wrote:
>>
>>> No, it always contains the default argument because default values are
>>> created just ONE TIME
<http://effbot.org/pyfaq/why-are-default-values-shared-between-objects>...
>> 
>> 
>> Wow, it's a very "dangerous" behavior ...
> 
> No, it's very *useful* behaviour.

Can you give an example of how useful it is? Something worth the pain of
newbies tripping over it every week?



More information about the Python-list mailing list