[PATCH] Re: frozenset() without arguments should return a singleton
Jp Calderone
exarkun at divmod.com
Sat Feb 12 18:18:26 EST 2005
On Sat, 12 Feb 2005 23:21:58 +0100, Stefan Behnel <stefan.behnel-n05pam at web.de> wrote:
>
>
> Raymond Hettinger wrote:
> >Stefan Behnel wrote:
> >>I stumbled over the fact that 'frozenset()' doesn't return a constant but
> >>creates a new object everytime. Since it is immutable, I wrote to c.l.py
> >>that this behaviour is different from what tuple() & Co do.
> >
> > It is not quite correct to say that this is what all immutables do:
> >
> >
> >.>>>x = 500
> >.>>>y = 600 - 100
> >.>>>x is y
> > False
>
> I know. The same is true for concateneted strings, etc. But whenever an
> immutable object is created directly ('by hand'), it holds. It also holds,
> btw, for tuple() - as opposed to ().
>
$ python
Python 2.3.5c1 (#2, Feb 4 2005, 10:10:56)
[GCC 3.3.5 (Debian 1:3.3.5-8)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> long() is long()
False
>>>
Jp
More information about the Python-list
mailing list