question od default args
Hans Nowak
wurmy at earthlink.net
Wed Jun 26 13:50:42 EDT 2002
Gonçalo Rodrigues wrote:
> Hi,
>
> 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.
Hmm, so use a default argument that is not reasonable to pass... some weird
string, or a complex number, or even an instance of a (singleton?) class
written especially for this... although that may be a bit overkill. Of course,
the question is what is "reasonable" here and what not...
--
Hans (base64.decodestring('d3VybXlAZWFydGhsaW5rLm5ldA=='))
# decode for email address ;-)
The Pythonic Quarter:: http://www.awaretek.com/nowak/
More information about the Python-list
mailing list