def args idiom and signatures
Emile van Sebille
emile at fenx.com
Wed Jan 19 11:47:14 EST 2000
In /F's Standard Python Library I spotted:
def _d(y, m, d, days=(0, 31, 59, ..., 334, 365)):
where the balance of the function relies on days having this value.
Trying to understand why it may be an argument vs defined within
the function, I suspect that as the def is only processed to bytecode
once, whereas an in-line assignment would be re-processed with
each execution, that the decision is performance based.
Now, in light of the various discussions pertaining to function
signatures, it seems that this idiom presents a particular problem.
Various munging of the name or introduction of a static type keyword
may help address this, but I'm curious if this common usage and
what people's thoughts are.
Or-even-if-my-understading-of-it-is-correct?-ly y'rs
Emile van Sebille
emile at fenx.com
-------------------
More information about the Python-list
mailing list