Can global variable be passed into Python function?
Ben Finney
ben+python at benfinney.id.au
Sat Mar 1 17:34:15 EST 2014
Marko Rauhamaa <marko at pacujo.net> writes:
> Ben Finney <ben+python at benfinney.id.au>:
>
> > No. I'm telling you that ‘is’ is *wrong* for comparing strings,
> > because it is unreliable.
>
> No, it isn't as long as the string object references have a common
> assignment "pedigree." Assignment (including parameter passing) is
> guaranteed to preserve identity of any object.
The unreliability isn't “will the same object have the same identity?”.
The unreliability is “will objects defined elsewhere have a different
identity?” In the case of Python strings, the latter question is not
reliably answerable from the programmer's perspective.
You are obstinately ignoring the point that the identity of a string is
*not* guaranteed to be different from a string with the same value.
Since you're persistently misconstruing what is being said to you, I'm
not going to run through it all again.
--
\ “[W]e are still the first generation of users, and for all that |
`\ we may have invented the net, we still don't really get it.” |
_o__) —Douglas Adams |
Ben Finney
More information about the Python-list
mailing list