Newbie Question
Brian Quinlan
brian at sweetapp.com
Mon Sep 17 15:16:53 EDT 2001
Mel wrote:
> My apologies for appearing to complain. I was simply trying to point
out
> that I had already done what you suggested, and had said so in my
original
> question.
I wasn't the one who answered your question; I just pointed out that you
were a bit rude to the one who did.
> However, when I use any of the suggested fixes things work just fine.
> Since I usually need much of the math modeule, my choice is to start
with
> from math import *
> and similarly for the other modules that I may need. But the other
fixes
> also work.,
I was not critiquing those solutions (though the frequent use of "from x
import *" statements should be avoided), I'm pointing out a
misconception that you might have about name lookup:
When python encounters an expression like this:
a()
It does two things:
1. It looks up the object associated with the name "a"
2. It calls that object
That is why Python said that a name/variable could not be found and not
a function; step one is only concerned with name lookup, it doesn't know
anything about the name's usage context.
Cheers,
Brian
More information about the Python-list
mailing list