Peter Pearson <ppear...@nowhere.invalid> writes:

> Hey, that's a cute example, but . . . what a trap! Is it possible to
> document the use-the-object-not-the-string requirement loudly enough
> that people won't get caught?

Don't use strings for such values. The data isn't going to be used, so
there's no sense using a semantically rich data type like a string.

Instead, use an ‘object’ instance; then, the only way to get a binding
that will compare equal is to use the very object itself.

FORWARD = object()
BACKWARD = object()

-- 
 \     “Never do anything against conscience even if the state demands |
  `\                                             it.” —Albert Einstein |
_o__)                                                                  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to