Tkinter callback arguments

Mel mwilson at the-wire.com
Mon Nov 2 10:46:48 EST 2009


Alf P. Steinbach wrote:
> * Peter Otten:
>> Alf P. Steinbach wrote:
>>> * Peter Otten:
>>>> unidiomatic None-checks
>>> What's the idiomatic Python way for an optional thing?
>> 
>> if some_value is None: ...
> 
> Thanks!
> 
> But why is this preferred?

I guess because `some_value == None` restricts your choices if you want to 
give some_value's usual class an __eq__ method.  It's a pretty arcane 
point.. but perhaps not.. the object named "some_value" might belong to a 
class that expects its instances only to be compared with each other, for 
the sake of economy and clear code.

	Mel.





More information about the Python-list mailing list