[Python-3000] sets in P3K?

Kendall Clark kendall at monkeyfist.com
Wed Apr 26 17:08:29 CEST 2006


On Apr 26, 2006, at 4:03 AM, Talin wrote:

> This means using '=' instead of ':' and allowing key names to be  
> bare words
> instead of quoted strings.

For my money, this is another use case for symbols in Py3K. I very  
often mistype string keys in dicts, where I think I would mistype  
symbols less often (Guido's !symbol syntax isn't half-bad), and where  
upon access would be much nicer too: compare my_dict["the_key"] with  
my_dict[!the_key]. Only one character saved (for me) but that adds up  
and you have fewer variants (my_dict['the_key'] or my_dict["the_key"]  
versus my_dict[!the_key]) -- of course I'm not saying that strings  
shoudln't be keys in dicts, only that for a lot of the common uses of  
dicts, symbols are better.

Cheers,
Kendall Clark




More information about the Python-3000 mailing list