"Stefan Behnel" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi! > > frozenset() doesn't behave as the other immutable empty data types in > 2.4: > > .>>> '' is '' > True > .>>> () is () > True
I believe the reference manual describes this sort of behavior for immutables as an *optional* optimization. 0 is 0 and has been since at least 1.3. I am not sure both of your statements above have been true as long, but I not longer have 1.3 to check ;-). > .>>> frozenset() is frozenset() > False > frozenset() called without arguments (or on empty sequences) > should always return a singleton object. If we interpret 'should' as 'preferably by me', ok. >It is immutable, so I can't see a reason why it should take up more >resources than necessary. It will take some programmer's time to add the special case check and run the test suite, and check in the changes. Yours? And perhaps some execution time for each frozenset call. Since frozenset is not much used, and multiple empty frozensets very rare, and the difference mostly invisible, the frozenset implementor probably went on to other things. Terry J. Reedy -- http://mail.python.org/mailman/listinfo/python-list