Use cases for del

Leif K-Brooks eurleif at ecritters.biz
Wed Jul 6 23:44:35 EDT 2005


Grant Edwards wrote:
> On 2005-07-07, Leif K-Brooks <eurleif at ecritters.biz> wrote:
>>_NOVALUE = object()
>>class demo:
>>    def foo(v=_NOVALUE):
>>        if v is _NOVALUE:
>>            return self.v
>>        else:
>>            self.v = v
> 
> 
> Apart from the change in the logic such that the set operation
> doesn't return a value, how is that any different?  You're just
> creating your own non-integer-value "None" object instead of
> using the one built in to the language.

Sorry, my mistake: for some reason, I misunderstood your message as
complaining that you couldn't do the same thing if you needed None to be
usable as a value too.

>>But what's wrong with properties?
> 
> Huh?

Why not use a property
(http://www.python.org/2.2.1/descrintro.html#property) instead of a
special property-like method?



More information about the Python-list mailing list