On 30/03/12 17:58, Mark Lawrence wrote:
The recipe here
http://code.activestate.com/recipes/410692-readable-switch-construction-without-lambdas-or-di/
refers to several other recipes which you might want to take a look
at, sorry I meant to mention this earlier.
Oh, that's neat. Not worth putting into my little project, but I've
bookmarked that on for when I need a lot of cases. It also shows how to
define a class - that was something I had wondered about, but not yet
tackled.
I'm really grateful for the answers I have received. It will take me a
while to get my head around some of the less obvious code fragment that
folk have kindly posted, but I will play around with all of them in due
course. Already the code I am playing with has shrunk to about half the
number of lines it was before I joined this list and I'm even more than
ever impressed with the language. I also like the fact that it can be
played with as an interpreted language. Compiling and debugging c code
could be a pain at times. In Python, a few print statements together
with the syntax error messages from the interpreter make it very easy to
see what's happening.
Kind regards, Barry.
--
From Barry Drake - a member of the Ubuntu advertising team.
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor