Variable name has a typo, but code still works. Why?
- From: "mateus" <mateus.justino@xxxxxxxxx>
- Date: 31 May 2006 06:30:36 -0700
print "hello world"
I have a nested loop where the outer loop iterates over key value pairs
of a dictionary and the inner loop iterates over a list each list of
which is a mapped value from the dictionary
def showReport(self):
for dev, sessions in self.logger.items():
for tree in session:
self.addTestItem(self, tree)
What I don't understand is why this executes w/o any problems when
"sessions" was spelled as plural (sessionS) while later being spelled
in the singular (session).
Is there some type of name resolution of local variables where Python
makes assumptions?
.
- Follow-Ups:
- Re: Variable name has a typo, but code still works. Why?
- From: Max Erickson
- Re: Variable name has a typo, but code still works. Why?
- From: Max M
- Re: Variable name has a typo, but code still works. Why?
- From: Tim N. van der Leeuw
- Re: Variable name has a typo, but code still works. Why?
- From: hwiechers
- Re: Variable name has a typo, but code still works. Why?
- From: mateus
- Re: Variable name has a typo, but code still works. Why?
- Prev by Date: Re: Way to get an array of latitude/longitude points (tuples) from a trip
- Next by Date: Re: Variable name has a typo, but code still works. Why?
- Previous by thread: os.popen3() - how to close cmd window automatically?
- Next by thread: Re: Variable name has a typo, but code still works. Why?
- Index(es):
Relevant Pages
|