PyMite v9 - global/local var covering exception

54 views
Skip to first unread message

xinx

unread,
Jul 21, 2014, 9:38:50 AM7/21/14
to python-o...@googlegroups.com
This bad piece of code results in a strange error message

> a = 4
> def test():
...   print a
...   print type(a)
...   a = a + 2
...   print a

> test()

None
0
Traceback (most recent call first):
   File "<ipm>", line 3, in test
   File "<ipm>", line 1, in <ipm>
   File "lib/ipm.py", line 102, in ipm
   File "main.py", line 29, in main
 TypeError detected by FileId 0x00 line 0

I don't know if this behaviour is still valid for more recent versions of pymite but in case it is, perhaps, there is an easy solution to fix this? Standard python complains this way...

UnboundLocalError: local variable 'a' referenced before assignment

... which sounds very reasonable.

Thank you for your time and support!

Michael

Reply all
Reply to author
Forward
0 new messages