Passing a callable object to Thread

Paul Rubin http
Mon Feb 18 19:22:22 EST 2008


Jeff Schwab <jeff at schwabcenter.com> writes:
> I think you're a little confused about the meaning of "numeric
> literal." (5+1) is not a numeric literal.  Neither is
> (999999999999999999999999999999+1).
> 
> The flyweight pattern does not guarantee that all equivalent instances
> of an object type will be identical.  

I don't think there's any Python language rule that says multiple uses
of the same numeric literal turn into the same object.  It's just an
optimization (constant folding) that the CPython implementation
happens to perform.  Other implementations might not do it, or CPython
might do it differently in some future version.



More information about the Python-list mailing list