Gerald Britton wrote:
However,  I would like a deeper
understanding of why I cannot use "foo" as an unqualified variable
inside the method in the class.  If Python allowed such a thing, what
problems would that cause?

8<----------------------------------------------------
"script with possible name clashes"

eggs = 'scrambled eggs'
meat = 'steak'

class Breakfast():
    meat = 'spam'
    def serve(self):
        print("Here's your %s and %s!" %
               (eggs, meat))

Breakfast().serve()
8<----------------------------------------------------

What will serve print?

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to