mutable default parameter problem [Prothon]

Mark Hahn mark at prothon.org
Thu Jun 17 00:41:07 EDT 2004


"Dave Brueck" <dave at pythonapocrypha.com> wrote

> > > I like more as an example:
> > >
> > >    >>> def foo(x):
> > >    ...   if not hasattr(foo,'list'):
> > >    ...     foo.list = []
> > >    ...   foo.list.append(x)
> > >    ...   print foo.list
> >
> > In Prothon:
> >
> >     def foo(x):
> >             print foo.list.append!(x)
> >     foo.list = []
> >
> > (Sorry. I couldn't resist bragging.)
>
> About what?

Is there an echo in here?  :-)





More information about the Python-list mailing list