Le mercredi 03 mai 2006 à 09:22 -0400, Greg Wilson a écrit :
> I obviously haven't done the experiment yet, but I can pretty much
> guarantee you that newbies will trip over the inconsistency you're
> proposing:
> 
>     Type    Two elements        One element        Empty
>     List    [1, 2]              [1]                []
>     Dict    {1:'a', 2:'b'}      {1:'a'}            {}
>     Set     {1, 2}              {1}                set()
> 
> One of these things is not like the others...  One of these things just
> doesn't belong...  Or is "regular enough that newcomers' guesses about
> what to type are usually right" no longer a design consideration?

Something has to be sacrificed anyway, because there is no way to have a
simple and obvious notation for all three types (I do not find {:} or
{/} simple and obvious).

I think lists and dicts are fundamental data types for which there is an
immediate need, whereas sets are an useful optimization, like dequeues
or heaps. Therefore sets are less likely to be used by newcomers.

One symptom of that is that lists and dicts also have syntactic support
in e.g. PHP or Perl, whereas sets don't.


_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to