def args idiom and signatures

Evan Simpson evan at tokenexchange.com
Fri Jan 21 16:23:12 EST 2000


Emile van Sebille <emile at fenx.com> wrote in message
news:034401bf62f7$4fa7bba0$01ffffc0 at worldnet.att.net...
> Well, wouldn't this be exposing what probably ought to be a private
> function variable?  If a function signature shows the def's argument
> structure, how could a user tell that the intent is to *not* override
> the value, and that doing so would break the function?  I know in
> this case the value itself ("000031028...") pretty much says that, but
> I can easily imagine other values being pre-set in the def to avoid
> the overhead.

That's why in another thread we're pushing for syntax changes which would
allow (among other things)...

def _d(y, m, d, *, days=(0, 31, 59, ..., 334, 365)):

...to prevent 'days' from being part of the function signature while still
allowing it to be pre-defined this way.

Cheers,

Evan @ 4-am





More information about the Python-list mailing list