Can global variable be passed into Python function?

Roy Smith roy at panix.com
Sat Mar 1 19:30:06 CET 2014


In article <87mwh9969m.fsf at elektro.pacujo.net>,
 Marko Rauhamaa <marko at pacujo.net> wrote:

> Michael Torrie <torriem at gmail.com>:
> 
> > No, '==' works fine no matter what objects you assign to your state
> > variables.
> 
> Well, it doesn't since
> 
>    >>> a = float("nan")
>    >>> a is a
>    True
>    >>> a == a
>    False
> 
> More generally, it depends on how the __eq__ method has been implemented
> for the class. You might even (foolishly) define a class such that:
> 
>    >>> a == b
>    False
>    >>> a != b
>    False

Well, there's always things like SQL's NULL, which is both not equal and 
not not equal to itself.



More information about the Python-list mailing list