Bug in python!? persistent value of an optional parameter in function!
George Sakkis
george.sakkis at gmail.com
Wed Mar 7 23:06:44 EST 2007
On Mar 7, 10:24 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> John Nagle <n... at animats.com> writes:
> > True. It would make sense to disallow mutable values as
> > initial values for optional arguments. The present behavior is silly.
>
> That would be the worst of both worlds. The main alternative to the
> present behavior is re-computing the default value every time the
> function is entered.
One can do this is today's Python if he's so inclined, albeit with a
more verbose syntax: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502206
George
More information about the Python-list
mailing list