Can global variable be passed into Python function?

Ben Finney ben+python at benfinney.id.au
Sun Mar 2 11:59:26 CET 2014


Marko Rauhamaa <marko at pacujo.net> writes:

> Ben Finney <ben+python at benfinney.id.au>:
>
> > The unreliability is “will objects defined elsewhere have a different
> > identity?”
>
> That question is not interesting in my context, and has no bearing on
> the correctness of the program.

You keep vacillating between two positions: pick one for the context.

Either you care about object identity in this context, and the above
observation is relevant.

Or, you don't care about object identity in this context, and you should
avoid ‘is’ and use ‘==’.

But you cannot have both.

-- 
 \        “You know I could rent you out as a decoy for duck hunters?” |
  `\                                                     —Groucho Marx |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list