easy question on parsing python: "is not None"
matt at schinckel.net
Fri Aug 13 04:52:07 CEST 2010
On Aug 6, 8:15 am, "Rhodri James" <rho... at wildebst.demon.co.uk> wrote:
> On Thu, 05 Aug 2010 17:07:53 +0100, wheres pythonmonks
> <wherespythonmo... at gmail.com> wrote:
> > Well, I am not convinced of the equivalence of not None and true:
> >>> "spam, eggs, chips and spam" is "spam, eggs, chips and spam"
> >>> a = "spam, eggs, chips and spam"
> >>> b = "spam, eggs, chips and spam"
> >>> a is b
>>> a = "hello"
>>> b = "hello"
>>> a is b
Ooh, that looks dangerous. Are they the same object?
>>> a += "o"
(Python does not make two copies of small strings until it needs to).
More information about the Python-list