mutable default parameter problem [Prothon]

Dave Brueck dave at pythonapocrypha.com
Wed Jun 16 23:19:10 EDT 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