Symbols as parameters?

Ben Finney ben+python at benfinney.id.au
Fri Jan 22 02:06:13 CET 2010


Carl Banks <pavlovevidence at gmail.com> writes:

> On Jan 21, 1:51 pm, Martin Drautzburg <Martin.Drautzb... at web.de>
> wrote:
> > (2) Using enum's was suggested. That is good to know, but again it
> > is just a way to define constants in the caller's namespace.
>
> It'll at least corral the symbols you want.

It also satisfies the strongly-expressed demand you had for these
constants to *not* be strings. It keeps the semantic meaning of these
constants very distinct, and greatly reduces the possibility of an
object accidentally having the same value as one of these constants.

-- 
 \             “Roll dice!” “Why?” “Shut up! I don't need your fucking |
  `\     *input*, I need you to roll dice!” —Luke Crane, demonstrating |
_o__)                       his refined approach to play testing, 2009 |
Ben Finney



More information about the Python-list mailing list