[Python-ideas] Re: Suggestion for language addition

2020-01-23 Thread Neil Girdhar
On Tuesday, December 3, 2019 at 7:54:03 PM UTC-5, Jan Bakuwel wrote: > > Hi Guido, > > On 4/12/19 1:06 pm, Guido van Rossum wrote: > > I was playing the devil's advocate in jest. There is no way this will > > be added to Python, for a large variety of sociological and software > >

[Python-ideas] Re: Suggestion for language addition

2020-01-16 Thread Rob Cliffe via Python-ideas
On 04/12/2019 23:41:19, Andrew Barnert via Python-ideas wrote: On Dec 4, 2019, at 12:14, Mike Miller wrote:  On 2019-12-04 11:05, David Mertz wrote: I've often wanted named loops. I know approaches to this have been proposed many times, and they all have their own warts. E.g. an ad hoc

[Python-ideas] Re: Suggestion for language addition

2019-12-05 Thread Eric Fahlgren
My little experiments in 3.7 show exception setup is about 40% more costly than just a do-nothing loop, but execution of is about 9x more expensive than doing nothing, so actually very little cost if your loop only rarely catches the exception (I assume you'll probably actually do something inside

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Serhiy Storchaka
05.12.19 04:43, Andrew Barnert via Python-ideas пише: Yes, you have to unlearn it. Exceptions are not that expensive in Python (and in a lot of other modern languages)—but even if they were, you’d still have to deal with the fact that Python uses them pervasively. Every for loop ends with an

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Jan Bakuwel
Hi Andrew, On 5/12/19 3:43 pm, Andrew Barnert wrote: On Dec 4, 2019, at 17:55, Jan Bakuwel wrote: Just read Guido's reason for rejecting named loops, interesting. It seems we have different ideas about what "code clarity" means and that's perfectly fine of course. Beauty is in the eye of

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
On Dec 4, 2019, at 17:55, Jan Bakuwel wrote: > > > Just read Guido's reason for rejecting named loops, interesting. It seems we > have different ideas about what "code clarity" means and that's perfectly > fine of course. Beauty is in the eye of the beholder. To refer once again to > Ada

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Jan Bakuwel
On 5/12/19 1:03 pm, David Mertz wrote: Actually, I found it's rejected PEP: https://www.python.org/dev/peps/pep-3136/. It looks like the first of several ideas there matches my ad hoc syntax. It *was* 2007, in distant pre-walrus memory. But I'm not sure the SC would revisit Guido's ruling.

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
On Dec 4, 2019, at 16:04, David Mertz wrote: > >  > Actually, I found it's rejected PEP: > https://www.python.org/dev/peps/pep-3136/. > > It looks like the first of several ideas there matches my ad hoc syntax. It > *was* 2007, in distant pre-walrus memory. But I'm not sure the SC would >

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread David Mertz
Actually, I found it's rejected PEP: https://www.python.org/dev/peps/pep-3136/. It looks like the first of several ideas there matches my ad hoc syntax. It *was* 2007, in distant pre-walrus memory. But I'm not sure the SC would revisit Guido's ruling. On Wed, Dec 4, 2019, 6:45 PM Andrew Barnert

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
On Dec 4, 2019, at 12:14, Mike Miller wrote: > >  >> On 2019-12-04 11:05, David Mertz wrote: >> I've often wanted named loops. I know approaches to this have been proposed >> many times, and they all have their own warts. E.g. an ad hoc pseudo code >> that may or may not match any previous

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Andrew Barnert via Python-ideas
On Dec 4, 2019, at 14:56, Oscar Benjamin wrote: > > My suggestion would be to use a > function rather than exceptions: > > stuff = [10, 20, 30] > other_stuff = [1, 2, 3] > > def func(): >for x in stuff: >for y in other_stuff: >print(x, y) >if x + y > 21: >

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Soni L.
On 2019-12-04 6:05 p.m., Anders Hovmöller wrote: > On 4 Dec 2019, at 21:28, Soni L. wrote: > >  > >> On 2019-12-04 5:12 p.m., Mike Miller wrote: >> >>> On 2019-12-04 11:05, David Mertz wrote: >>> I've often wanted named loops. I know approaches to this have been proposed many times,

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread David Mertz
These are all a little bit ugly IMO. I've never written the contextlib.suppress style, but I have the others. Usually what I'll actually do is: for x in stuff: break_outer = False for y in other_stuff: do_whatever(x, y) if cond: break_outer = True

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Oscar Benjamin
On Wed, 4 Dec 2019 at 21:16, Anders Hovmöller wrote: > > On 4 Dec 2019, at 21:28, Soni L. wrote: > >> On 2019-12-04 5:12 p.m., Mike Miller wrote: > >> > >>> On 2019-12-04 11:05, David Mertz wrote: > >>> I've often wanted named loops. I know approaches to this have been > >>> proposed many

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Anders Hovmöller
> On 4 Dec 2019, at 21:28, Soni L. wrote: > >  > >> On 2019-12-04 5:12 p.m., Mike Miller wrote: >> >>> On 2019-12-04 11:05, David Mertz wrote: >>> I've often wanted named loops. I know approaches to this have been proposed >>> many times, and they all have their own warts. E.g. an ad hoc

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Soni L.
On 2019-12-04 5:12 p.m., Mike Miller wrote: On 2019-12-04 11:05, David Mertz wrote: I've often wanted named loops. I know approaches to this have been proposed many times, and they all have their own warts. E.g. an ad hoc pseudo code that may or may not match any previous proposal: for x

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Mike Miller
On 2019-12-04 11:05, David Mertz wrote: I've often wanted named loops. I know approaches to this have been proposed many times, and they all have their own warts. E.g. an ad hoc pseudo code that may or may not match any previous proposal: for x in stuff as outer:     for y in other_stuff as

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread David Mertz
On Wed, Dec 4, 2019, 3:31 AM Jan Bakuwel wrote: > Ada even has "named loops", a really cool feature that allows you to exit > an outer loop inside an inner loop by "exiting" the loop referring to it's > name > While I am among the everybody not convinced by needing "end" constructs, I've often

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Chris Angelico
On Wed, Dec 4, 2019 at 7:28 PM Jan Bakuwel wrote: > It's clear that I failed to convince even a single person so it's time > to drop it. Great to have this list to test the waters so to speak :-) > This is exactly why not every idea needs a PEP :) Discuss first, PEP later. ChrisA

[Python-ideas] Re: Suggestion for language addition

2019-12-04 Thread Jan Bakuwel
Hi Andrew, On 4/12/19 5:15 pm, Andrew Barnert wrote: On Dec 3, 2019, at 14:34, Jan Bakuwel wrote: People focus on the silly example and suggest that the code needs refactoring but that is besides the point. You’re the one who gave that example as motivation, and who specifically

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Greg Ewing
On 4/12/19 1:51 pm, Jan Bakuwel wrote: Has it been rejected as PEP or as an idea? There has never been a PEP on it as far as I remember. Probably because it always gets shot down before it gets anywhere near that stage. One of the probable reasons for that is summed up by "preferably only

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Andrew Barnert via Python-ideas
On Dec 3, 2019, at 14:34, Jan Bakuwel wrote: > > People focus on the silly example and suggest that the code needs refactoring > but that is besides the point. You’re the one who gave that example as motivation, and who specifically highlighted the “more than a page of code” thing; it’s not

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Andrew Barnert via Python-ideas
On Dec 3, 2019, at 16:54, Jan Bakuwel wrote: > >> On 4/12/19 1:07 pm, Greg Ewing wrote: >>> On 4/12/19 11:06 am, Jan Bakuwel wrote: >>> If being brought up many times, sounds like a perfect candidate for a >>> PEP to me. >> >> The implication is that it has been brought up AND REJECTED

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Stephen J. Turnbull
Jan Bakuwel writes: > Interesting. Has it been rejected as PEP or as an idea? In this context "PEP" and "idea" are interchangeable, except that "ideas" aren't listed in PEP 0. > Having a list of "rejected" ideas/PEPs with the reasons why it was > rejected would indeed be great to have. The

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Stephen J. Turnbull
Jan Bakuwel writes: > While I like Python a lot, I do miss the support of advanced compilers > that tell me at compile time where I made a typo or logic error so I > find myself spending relatively more time debugging at runtime. That's inherent in an implementation that compiles "just in

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi Guido, On 4/12/19 1:06 pm, Guido van Rossum wrote: I was playing the devil's advocate in jest. There is no way this will be added to Python, for a large variety of sociological and software engineering reasons. While some of the responses may to you seem like they come from inexperienced

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi Greg, On 4/12/19 1:07 pm, Greg Ewing wrote: On 4/12/19 11:06 am, Jan Bakuwel wrote: If being brought up many times,  sounds like a perfect candidate for a PEP to me. The implication is that it has been brought up AND REJECTED multiple times. But you do have a point -- a rejected PEP

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Greg Ewing
On 4/12/19 11:06 am, Jan Bakuwel wrote: If being brought up many times, sounds like a perfect candidate for a PEP to me. The implication is that it has been brought up AND REJECTED multiple times. But you do have a point -- a rejected PEP would provide documentation of the reasons

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Guido van Rossum
I was playing the devil's advocate in jest. There is no way this will be added to Python, for a large variety of sociological and software engineering reasons. While some of the responses may to you seem like they come from inexperienced people who have not carefully read your argument, consider

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi all, Thanks for the feedback on the list. I just got here but enjoy the discussion. Here's my summary of what I've read. - What I've suggested has been brought up many times before. In other words, there are a lot of people who think this is useful. - People focus on the silly example

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi Chris, On 3/12/19 5:07 pm, Christopher Barker wrote: This is a nonstarter — meaningful indentation is a pretty baked-in ( and liked ) part of the language. I know. However why not have something that suits even more people. Meaningful indentation is great (and liked here) too... but it

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi Andrew, On 3/12/19 5:48 pm, Andrew Barnert wrote: On Mon, Dec 2, 2019 at 3:12 PM Jan Bakuwel > wrote: Code example: def func (i: int, j: int, k: int) -> None: if (i == 3):     while (i < 15):         i += 1         if (k == 8):        

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi Andrew, On 3/12/19 9:01 pm, Andrew Barnert wrote: On Dec 2, 2019, at 21:00, Guido van Rossum wrote: 3) I have been known to hold a ruler against my screen to double-check indentation. Well, if that isn’t part of your integrated development environment, you just need to switch to emacs

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Jan Bakuwel
Hi J, On 3/12/19 9:06 pm, J. Pic wrote: For me it's really easy given your example without the end statements. I suppose your use case is actually about much longer code, with much more cyclomatic complexity. Indeed. I recommend you run McCabe's algorithm instead to help refactor your

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Serhiy Storchaka
03.12.19 02:02, Jan Bakuwel пише: Idea: To include optional "end if", "end while", "end for" and "end name>", "end " in the language. The Python interpreter would test that any "end" matches with the correct corresponding statements and have the correct indentation, in other words throw an

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread J. Pic
For me it's really easy given your example without the end statements. I suppose your use case is actually about much longer code, with much more cyclomatic complexity. I recommend you run McCabe's algorithm instead to help refactor your code. https://pypi.org/project/mccabe/

[Python-ideas] Re: Suggestion for language addition

2019-12-03 Thread Andrew Barnert via Python-ideas
On Dec 2, 2019, at 21:00, Guido van Rossum wrote: > > 3) I have been known to hold a ruler against my screen to double-check > indentation. Well, if that isn’t part of your integrated development environment, you just need to switch to emacs and give it control of a 3D printer and a robot and

[Python-ideas] Re: Suggestion for language addition

2019-12-02 Thread Guido van Rossum
To play the devil's advocate... (1) Using the (possible, future) PEG parser this would be easy to add to the grammar, as long as it's optional. (2) It can actually help readability in some cases, especially when e.g. 'for' and 'if' alternate. (3) I have

[Python-ideas] Re: Suggestion for language addition

2019-12-02 Thread Andrew Barnert via Python-ideas
On Mon, Dec 2, 2019 at 3:12 PM Jan Bakuwel wrote: > Code example: > > def func (i: int, j: int, k: int) -> None: > if (i == 3): > while (i < 15): > i += 1 > if (k == 8): > lots of other code (think a page or more) This is your actual

[Python-ideas] Re: Suggestion for language addition

2019-12-02 Thread Christopher Barker
This is a nonstarter — meaningful indentation is a pretty baked-in ( and liked ) part of the language. And yes, it’s been brought up many times before on this list. And it already exists: for item in a_sequence: do_some_stuff #end for :-) -CHB PS: I’m pretty sure some has written an