R
Richard Philips
Consider the script:
def test(drivers={}):
if drivers:
print drivers
else:
drivers["A"] = "B"
if __name__ == "__main__":
test()
test()
prints in stdout:
{'A': 'B'}
I expected that nothing would be displayed.
I do not understand this behaviour (python2.3 on WinXP and Linux).
If anybody can explain this situation, you are welcome.
Thank you.
--
================================================================
Dr. Richard PHILIPS
University of Antwerp
Systemmanager Anet
Phone: +32 3 820.21.53
Fax: +32 3 820.21.59
GSM: 0478/36.76.28
Email: (e-mail address removed)
================================================================
def test(drivers={}):
if drivers:
print drivers
else:
drivers["A"] = "B"
if __name__ == "__main__":
test()
test()
prints in stdout:
{'A': 'B'}
I expected that nothing would be displayed.
I do not understand this behaviour (python2.3 on WinXP and Linux).
If anybody can explain this situation, you are welcome.
Thank you.
--
================================================================
Dr. Richard PHILIPS
University of Antwerp
Systemmanager Anet
Phone: +32 3 820.21.53
Fax: +32 3 820.21.59
GSM: 0478/36.76.28
Email: (e-mail address removed)
================================================================