Antoon Pardon <[EMAIL PROTECTED]> writes: >>> Well there are two possibilities I can think of: >>> >>> 1) >>> arg_default = ... >>> def f(arg = arg_default): >>> ... >> >> Yuch. Mostly because it doesn't work: >> >> arg_default = ... >> def f(arg = arg_default): >> ... >> >> arg_default = ... >> def g(arg = arg_default): >> >> That one looks like an accident waiting to happen. > It's not because accidents can happen, that it doesn't work. > IMO that accidents can happen here is because python > doesn't allow a name to be marked as a constant or unreboundable.
Loets of "accidents" could be fixed if Python marked names in various ways: with a type, or as only being visible to certain other types, or whatever. A change that requires such a construct in order to be usable probably needs rethinking. Even if that weren't a problem, this would still require introducting a new variable into the global namespace for every such argument. Unlike other similar constructs, you *can't* clean them up, because the whole point is that they be around later. The decorator was an indication of a possible solution. I know it fails in some cases, and it probably fails in others as well. <mike -- Mike Meyer <[EMAIL PROTECTED]> http://www.mired.org/home/mwm/ Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information. -- http://mail.python.org/mailman/listinfo/python-list