Can global variable be passed into Python function?

Ben Finney ben+python at benfinney.id.au
Fri Feb 28 20:41:17 EST 2014


Marko Rauhamaa <marko at pacujo.net> writes:

> Ben Finney <ben+python at benfinney.id.au>:
>
> > They are *not* necessarily distinct from other strings with equal
> > value, defined elsewhere. That's what has been pointed out to you
> > many times.
>
> That point is completely irrelevant. The state objects only need to be
> distinct from each other.

In which case, don't mislead the reader by comparing with ‘is’.

Since you don't care about identity, only that the objects have
different values, you should be comparing for equality with ‘==’.

> How do I know? I originally wrote the example.

Yes. And as the author, you're being misleading by using the identity
comparison, when you don't care about their identity by your own
admission here.

-- 
 \          Eccles: “I'll get [the job] too, you'll see. I'm wearing a |
  `\        Cambridge tie.”  Greenslade: “What were you doing there?”  |
_o__)   Eccles: “Buying a tie.” —The Goon Show, _The Greenslade Story_ |
Ben Finney




More information about the Python-list mailing list