A very similar proposal was rejected: https://www.python.org/dev/peps/pep-3136/.
Also, see the discussion in https://mail.python.org/archives/list/python-ideas@python.org/thread/26PAGUTJ66S3BIZTL57IHUIYAHA7YOTV/#23H2S2AJFPRK46UID5MBHJJ7A3ERUBJA . If you'd still like to propose this, you'll have to present an argument against the reasons why the other proposals were rejected. On Mon, Dec 30, 2019 at 10:19 AM Oskar Promeuschel < promeuschel_os...@lsh-marquartstein.de> wrote: > Hello, > > I was thinking about giving loops names. And It would be interesting if > through this name in a continue or break statement could be called. > > A little example what I mean: > > > > loop *"outloop" **while True*: > actmonth = datetime.datetime.now().month > loop *"innerloop" **for *i *in *range(0, int(input())): > *if *datetime.datetime.now().month != actmonth: > *break * > *"outloop" **else*: > print(*"Waiting for a new Month..."*) > > > > *# Do some stuff if loop ended before new Month* > > > > Without giving names it’s always needed to define a new variable and a if > statement outside of the innerloop, like this: > > > > *while True*: > actmonth = datetime.datetime.now().month > shouldend = > *False for *i *in *range(0, int(input())): > *if *datetime.datetime.now().month != actmonth: > shouldend = > > *True break else*: > print(*"Waiting for a new Month..."*) > > *if *shouldend: > > > *break **# Do some stuff if loop ended before new Month* > > > > It’s possible without it, but it is more readable. > > Maybe another option is, but that’s too deep, to make loops to objects. > > > > Best Regards, > > Oskar Promeuschel > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/MWOQ67ARKHAUE6GN6WOVITPU3WAU5BEL/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/DKU3AGEBLZCAGUAZ37PPUATYP7A5BLW2/ Code of Conduct: http://python.org/psf/codeofconduct/