Alan Gauld wrote:

Use the list form, even though it does involve a few more keystrokes and a lot more screen space. The extra typing to avoid the problems are not worth it! :-)

If you're worried about the screen space and/or keystrokes, you can do this:

if direction.upper() in tuple('NSEW'): ...

instead of

if direction.upper() in ('N', 'S', 'E', 'W'): ...


You can also use list, set or frozenset instead of tuple., but I prefer tuple because it signals the intention that the result should be read-only.



--
Steven
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to