mutable default parameter problem [Prothon]

Dave Brueck dave at pythonapocrypha.com
Thu Jun 17 05:19:10 CEST 2004


Mark 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?

-Dave





More information about the Python-list mailing list