On Jan 24, 2008 8:12 PM, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> I hope it isn't too confusing that {1: 1} creates a *mutable* dict
> while {1} creates an *immutable* frozenset. I still find this slightly
> inelegant. But the practicality of being able to treat set literals as
> compile-time constants wins me over.

This probably will not go over well, but why not use the pipe
character to define a frozenset?

if urltxt in |'html', 'xml', 'php'|:

No way to confuse it with a dict, and as far as I know the pipe isnt
used for anything else that would conflict or confuse the issue.

Also on Raymonds point about repr being hard to read

 {frozenset([0, 1]): frozenset([frozenset([0]),
                               frozenset([1]),
                               frozenset([0, 1, 2])]),
 frozenset([0, 1, 2]): frozenset([frozenset([1, 2]),
                                  frozenset([0, 2]),
                                  frozenset([0, 1])])}


would become:

 {|0, 1|: ||0|,
          |1|,
          |0, 1, 2||,
 |0, 1, 2|: ||1, 2|,
            |0, 2|,
            |0, 1||}
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
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