[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: Use cases for del
From: Ron Adam <rrr () ronadam ! com>
Date: 2005-07-10 17:59:46
Message-ID: mmdAe.150621$VH2.140093 () tornado ! tampabay ! rr ! com
[Download RAW message or body]
Reinhold Birkenfeld wrote:
> 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.
Ok, I retested it... Not sure why I was coming up with a small
difference before. <shrug> It seemed strange to me at the time which
is part of why I asked.
My point was using strings "could" work in same context as None, (if
None acted as del), with out a performance penalty. Anyway, this is all
moot as it's an solution to a hypothetical situation that is not a good
idea.
> Additionally, using "is" with immutable objects is horrible.
Why is it "horrible"? Oh nevermind. ;-)
Cheers,
Ron
> 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