On 12/06/13 03:53, Jim Mooney wrote:

But I do like the idea of using plain old words, like "bad" as a
switch, instead of some inscrutable program-switch ;')


I don't. Trust me on this, you will regret it. As the Zen of Python says, "Explicit 
is better than implicit". It may seem like a good idea now, but some day you'll 
write code like this:


def reward(msg):
    print(msg)
    if 'link' in msg:
        administer_electric_shock()
    else:
        give_cake()


def administer_test(username):
    score = 0
    for question, answer in list_of_tests:
        response = input(question)
        if response == answer:
            score += 1
    if score > len(list_of_tests):
        msg = "Congratulations %s, you have passed!" % username
    else:
        msg = "%s, you are the weakest link!" % username
    reward(msg)


Can you see the bug?





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

Reply via email to