Tuple assignment and generators?
Sion Arrowsmith
siona at chiark.greenend.org.uk
Fri May 5 09:47:26 EDT 2006
vdrab <stijndesaeger at gmail.com> wrote:
>let's say there's a certain property P, for the sake of this loooong
>discussion, something
>more or less like a class or type's property of "having immutable
>values, such that any instance with value X has a single, unique
>representation in memory and any two instantiations of objects with
>that value X are in fact references to the same object".
>
>Then, for example, python strings have property P whereas python lists
>do not:
Er, no:
>>> x = "test!"
>>> y = "test!"
>>> x == y
True
>>> x is y
False
Strings only get a unique instance if they are valid identifiers.
Again, it's an optimisation issue. As with ints, it
>_depends_on_their_value_.
>I find it neither evident nor consistent. I don't think the above post
>explains this, regardless of how you read "implementation".
"Implementation dependent" => "Any behaviour you observe which is not
explicitly documented is not to be relied upon". Also, "Implementation
dependent" => "How this is implemented should be transparent and
irrelevant to the normal user". No, it's not particularly consistent.
Because it doesn't matter.
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list