On 2005-07-07, Leif K-Brooks <[EMAIL PROTECTED]> wrote: > Grant Edwards wrote: >> On 2005-07-07, Leif K-Brooks <[EMAIL PROTECTED]> 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.
Somebody had proposed eliminating None as a usable object and people who use None now should just use 0, [], "", or () depending on the "type" of the expected value. I was providing an example of where I would use None in a context where an "integer context" and where 0 wasn't a good substitue. >>>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? Habit and the desire to make it explicit that something more is going on that just assigning or evaluating an instance's attribute. -- Grant Edwards grante Yow! I want EARS! I at want two ROUND BLACK visi.com EARS to make me feel warm 'n secure!! -- http://mail.python.org/mailman/listinfo/python-list