def args idiom and signatures

Mark Jackson mjackson at wc.eso.mc.xerox.com
Wed Jan 19 12:42:22 EST 2000


"Emile van Sebille" <emile at fenx.com> writes:
> 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

Um. . .flexible leap year handling?

Sweden-once-had-a-February-30th-ly y'rs,

-- 
Mark Jackson - http://www.alumni.caltech.edu/~mjackson
    Faced with the choice between changing one's mind and proving
    there is no need to do so, almost everybody gets busy on the proof.
				- John Kenneth Galbraith





More information about the Python-list mailing list