[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Use cases for del
From: Reinhold Birkenfeld <reinhold-birkenfeld-nospam () wolke7 ! net>
Date: 2005-07-10 8:49:36
Message-ID: 3jc5p0Fp4nlgU1 () individual ! net
[Download RAW message or body]
Ron Adam wrote:
>> >>> 'abc' is 'abcd'[:3]
>> False
>
> Well of course it will be false... your testing two different strings!
> And the resulting slice creates a third.
>
> Try:
>
> ABC = 'abc'
>
> value = ABC
> if value is ABC: # Test if it is the same object
> pass
That's not going to buy you any time above the "is None", because identity-
testing has nothing to do with the type of the object.
Additionally, using "is" with immutable objects is horrible.
Reinhold
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic