On 4/24/2011 5:58 AM, Steven D'Aprano wrote:
Consider this in Python 3.1:


def f(a=42):
...     return a
...
f()
42
f.__defaults__ = (23,)
f()
23


Is this an accident of implementation, or can I trust that changing
function defaults in this fashion is guaranteed to work?

Interesting question. It seems not to be documented, so I would not count on anything. This is a bit of a gray area, and if you get no answer here, try pydev list, perhaps as a request that special names be more completely documented, even is just as implementation details subject to change.


--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to