Antoon Pardon <[EMAIL PROTECTED]> writes:
> Now in this case you could start by assigning arg the value 1 and
> eliminate the if test. However that only works if you know the
> default value for the argument. What he seems to be asking for
> is if there is an object, (let as call it Default), that would
> make code like:
>
> def f(var=1):
>
> Equivallent to:
>
> def f(var=Default)
> if var is Default)
> var = 1
Oh, I see. Yes, the OP should just use a distinct default value
instead of 1. I usually do this with
sentinel = object()
def f(var=sentinel):
if var is sentinel:
# f was called without an arg
--
http://mail.python.org/mailman/listinfo/python-list