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

Fredrik Lundh fredrik at pythonware.com
Thu Nov 23 13:56:57 EST 2006


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? ;-)

</F>




More information about the Python-list mailing list