Can global variable be passed into Python function?

Marko Rauhamaa marko at pacujo.net
Sun Mar 2 22:03:30 CET 2014


Michael Torrie <torriem at gmail.com>:

> I don't see why == wouldn't continue to work if os.POSIX_FADV_RANDOM
> became an object of a different type.

It probably would.

If one were begging for trouble, one *could* define:

   class ABC:
       A = 1
       B = 1.0
       C = 1+0j

Now:

   ABC.A == ABC.B
   ABC.B == ABC.C
   ABC.C == ABC.A

but:

   ABC.A is not ABC.B
   ABC.B is not ABC.C
   ABC.C is not ABC.A


Marko



More information about the Python-list mailing list