Symbols as parameters?

Bearophile bearophileHUGS at
Thu Jan 21 10:15:38 CET 2010

Martin Drautzburg, having symbols spread in the namespace is bad. And
too much magic is even worse. You seem to need something like an enum
that must be used with its qualified name, as:
That works well unless the symbols name are keywords.

Creating a small class like this (that warns if you give it a string
that contains a keyword) looks not too much hard:
direction = Enum("up", "down", "left", "right")
direction = Enum("up, down, left, right")
direction = Enum("up down left right")


More information about the Python-list mailing list