default value in __init__

Aaron "Castironpi" Brady castironpi at gmail.com
Thu Oct 16 00:15:52 EDT 2008


On Oct 15, 11:05 pm, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message <01006451$0$20646$c3e8... 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?

Not to be overly practical, but what kind of community push would van
Rossum need in order to make a change, especially with 3.0 almost
out?  Even if everyone agrees, it seems too late even for the entire
3.x series, to be changing something that deeply embedded in not only
_syntax_, but programmers' minds.  I'd say a decorator would be a
viable alternative, but even that would be hard to get into the
language now.



More information about the Python-list mailing list