Different types of dicts with letter before the curly braces.

Rhodri James rhodri at wildebst.demon.co.uk
Sun Jun 14 18:23:06 EDT 2009


On Sun, 14 Jun 2009 12:02:47 +0100, kindly <kindly at gmail.com> wrote:

> I am sure people have thought of this before, but I cant find where.
> I think that python should adapt a way of defining different types of
> mapping functions by proceeding a letter before the curly brackets.
> i.e   ordered = o{},  multidict = m{}  (like paste multidict).  So you
> could define an ordered dict by newordered = o{"llvm" : "ptyhon",
> "parrot" : "perl"} .  (they should also probably have there own
> comprehensions as well o{foo for bar in foobar}).

-1.  And before you ask, that would have been my reaction to the
'u' and 'b' string prefixes as well.

Python has perfectly good constructors for any class already, and
it's perfectly obvious what they're doing because they involve the
class name.  Obfuscating this by using one character modifiers on
existing literal syntax and expecting the result to be (a) obvious
and (b) meaningful in the face of an ever-extending collection of
basic types is optimistic in the extreme.  Even Perl doesn't
expect that much memory of you!

-- 
Rhodri James *-* Wildebeest Herder to the Masses



More information about the Python-list mailing list