[Python-bugs-list] dir function anomoly (PR#174)
dennis.mccoy@mindspring.com
dennis.mccoy@mindspring.com
Sun, 9 Jan 2000 17:58:04 -0500 (EST)
Full_Name: Dennis McCoy
Version: 1.5.2
OS: Win 95
Submission from: user-33qsde3.dialup.mindspring.com (199.174.53.195)
Coded and saved a module with the following content
# div.py
def remainder(a,b):
q = a/b
r = a - q*b
return r
def divide(a,b):
q = a/b
r = a - q*b
return (q,r)
Wrote a script that imports all the functions in div.py
# bug2.py
from div import * # Import all the functions in the module div.py
x = dir() # Get all the namespace entries except for the
print x # and print them
x = dir(div) # x is supposed to get the contents of module div
print x
The first call for dir() works as expected and reports both of the functions
in the imported file div.py
The second call for dir(div) generates the following Python error:
NameError: div