S
Stefan Behnel
Hi!
frozenset() doesn't behave as the other immutable empty data types in 2.4:
..>>> '' is ''
True
..>>> () is ()
True
..>>> frozenset() is frozenset()
False
..>>> id(()),id(())
(1077579820, 1077579820)
..>>> id(())
1077579820
..>>> id(frozenset()),id(frozenset())
(1077581296, 1077581296)
..>>> id(frozenset())
1077581440
..>>> id(frozenset(()))
1077582256
frozenset() called without arguments (or on empty sequences) should always
return a singleton object. It is immutable, so I can see no reason why it
should take up more resources than necessary.
Stefan
frozenset() doesn't behave as the other immutable empty data types in 2.4:
..>>> '' is ''
True
..>>> () is ()
True
..>>> frozenset() is frozenset()
False
..>>> id(()),id(())
(1077579820, 1077579820)
..>>> id(())
1077579820
..>>> id(frozenset()),id(frozenset())
(1077581296, 1077581296)
..>>> id(frozenset())
1077581440
..>>> id(frozenset(()))
1077582256
frozenset() called without arguments (or on empty sequences) should always
return a singleton object. It is immutable, so I can see no reason why it
should take up more resources than necessary.
Stefan