builtin set literal

Steven Bethard steven.bethard at gmail.com
Tue Feb 20 14:46:57 EST 2007


Steven Bethard:
 > While Python 3.0 is not afraid to break backwards
 > compatibility, it tries to do so only when there's a very substantial
 > advantage.

bearophileHUGS at lycos.com wrote:
> I understand, but this means starting already to put (tiny)
> inconsistencies into Python 3.0...

Well, there's going to be an inconsistency one way or another:

Lists:
   [1, 2]
   [1]
   []

Dicts:
   {1:2, 2:1}
   {1:2}
   {}

Sets:
   {1, 2}
   {1}
   set()

Note that if we used {} for the empty set and {:} for the empty dict, 
then sets would be consistent, but dicts would be inconsistent. And if 
you're really worried about consistencies, take a look at the current 
state of tuples:

   1, 2
   1,
   ()

There's just not an obvious *right* answer here, so it's better to stick 
with the backwards compatible version.

STeVe



More information about the Python-list mailing list