Steven D'Aprano wrote:
On Mon, 20 Apr 2009 19:18:23 +1200, Lawrence D'Oliveiro wrote:

In message <gsg2iv$g5...@panix3.panix.com>, Aahz wrote:

What kind of OO language allows you to do this:

def square(x):
    return x*x

for i in range(10):
    print square(x)
Take out the "OO" qualifier, and the answer is still "none":

    Traceback (most recent call last):
      File "<stdin>", line 2, in <module>
    NameError: name 'x' is not defined


I can't replicate that error. Did you forget to initialize x before running the code snippet?

The code as posted had a typo: 'x' instead of the instended 'i'.

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

Reply via email to