On 2006-10-04, Nick Craig-Wood <[EMAIL PROTECTED]> wrote:
> Antoon Pardon <[EMAIL PROTECTED]> wrote:
>>  One possible way to do what I think you want is to code as follows:
>> 
>>  class Default (object):
>>    pass
>
> I'd have written
>
> Default = object()
>
>>  def f(var=Default):
>>    if var is Default:
>>      var = 1
>>    return var * 2
>
> But yes, defining a sentinel like this is a good idea.

The problem is that a lot of built in and library functions
are not written this way. So when f is one of those, you
are stuck.

-- 
Antoon Pardon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to