weird behaviour breaking from a nested loop

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
jose1711@gmail.com
Posts: 3
Joined: Tue Jun 20, 2017 7:40 pm

weird behaviour breaking from a nested loop

Post by jose1711@gmail.com » Tue Jun 20, 2017 7:58 pm

please, consider the following code

for foo in range(10):
--print(foo)
--for bar in range(10):
----pass
--else:
----continue
--break

in a full-blown python the result is a sequence of numbers 0 through 9, micropython terminates at number 0. i am not sure if this is a micropython implementation, known issue or something else but i wonder if anyone sees something similar.

micropython is v1.8.5 on esp8266.

User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: weird behaviour breaking from a nested loop

Post by pythoncoder » Wed Jun 21, 2017 4:05 am

I can replicate this on the Unix build of MicroPython. I agree that the behaviour is wrong so it does appear that you've uncovered a bug. I'll raise an issue on GitHub.

[EDIT]
See https://github.com/micropython/micropyt ... -309975195
Peter Hinch
Index to my micropython libraries.

Damien
Site Admin
Posts: 647
Joined: Mon Dec 09, 2013 5:02 pm

Re: weird behaviour breaking from a nested loop

Post by Damien » Tue Jun 27, 2017 6:33 am

This issues has been fixed in the latest version of the code.

Post Reply