help on "from deen import *" vs. "import deen"

jfong at ms4.hinet.net jfong at ms4.hinet.net
Sun Nov 13 21:39:03 EST 2016


Running the following codes (deen.py) under Win32 python 3.4.4 terminal:

tbli = [0x66, 0x27, 0xD0]
tblm = [0 for x in range(3)]
def gpa(data):
    td = data ^ tblm[2]
    return td

I can get a correct answer this way:
>>> import deen
>>> deen.tblm = deen.tbli
>>> deen.gpa(0x7d)
173  # 0xad (= 0x7d ^ 0xd0) is decimal 173

But I get a wrong answer this way:
>>> from deen import *
>>> tblm = tbli
>>> gpa(0x7d)
125  # it's 0x7d, the tblm[2] is 0

Why? why! why:-(

--Jach




More information about the Python-list mailing list