question od default args

Erik Max Francis max at alcyone.com
Wed Jun 26 14:23:20 EDT 2002


"Gonçalo Rodrigues" wrote:

> When I want default args I usually do
> 
> def (arg = None):
>     ...
> 
> But what if I want to make None a reasonable argument too? That is, I
> want to know if the user has in fact passed an argument, and if not to
> do something special, with None (or whatever object) being a
> reasonable
> arg to be passed.

But then the question is, what would it makes sense for arg to have as a
value when the function is invoked without an argument?  It has to be
_something_.  If there are no "out-of-band" values that you can use to
signal "this default argument was not specified," then you're not going
to be able to distinguish the two.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, US / 37 20 N 121 53 W / ICQ16063900 / &tSftDotIotE
/  \ See the son in your bad day / Smell the flowers in the valley
\__/ Chante Moore
    Bosskey.net: Aliens vs. Predator 2 / http://www.bosskey.net/avp2/
 A personal guide to Aliens vs. Predator 2.



More information about the Python-list mailing list