9

I've tried doing this in Python 2.6, and it does "work":

>>> def f(i='I'): return i
...
>>> f.func_defaults = (10,)
>>> f()
10

But is this officially specified behavior, or am I hitting an implementation-specific behavior?

allyourcode
  • 21,871
  • 18
  • 78
  • 106

1 Answers1

13

In the documentation func_defaults is documented as "writable", so it would seem to be defined behavior.

BrenBarn
  • 242,874
  • 37
  • 412
  • 384