len(var) is [CONSTANT] equal to len(var) == [CONSTANT]?

Brian Quinlan brian at sweetapp.com
Thu Nov 23 16:09:48 EST 2006


Fredrik Lundh wrote:
> Brian Quinlan wrote:
> 
>>> 4) [] and {} always create a new object every time they're evaluated.
>> Not quite. The empty tuple is cached:
>>
>>  >>> a = ()
>>  >>> b = ()
>>  >>> a is b
>> True
> 
> () isn't [] or {}, though.  time to switch to a bigger font? ;-)

Yeah, sorry I'm an idiot. I can't believe that I've been able to program 
successfully for so long when I can't recognize the different between a 
dictionary and a tuple :-)

Cheers,
Brian



More information about the Python-list mailing list