Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Steven D'Aprano
On Sun, May 20, 2018 at 12:21:16AM -0500, Tim Peters wrote: > I was an early REBOL user, and my head still hurts ;-) It was ... > different, for sure. [...] Yeah, to me it looks more like a prefix version of Forth than Lisp. Complete with "anything can be a name": > Yup! "i1+2=3*88" is a

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Tim Peters
[Steven D'Aprano ] > ... > Red (2011) > ... > ... claims to be nearly identical to Rebol. > > Wikipedia describes Rebol (and presumably Red) as not having either > expressions or statements in usual sense. Based on my reading, it is > kinda-sorta like Forth except without the

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Matt Arcidy
On Sat, May 19, 2018, 11:07 Kirill Balunov wrote: > > > I think I have a very strong argument "why are not others valid" - Because > already three months have passed and among 1300+ messages there was not a > single real example where assignment expression would be

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Chris Angelico
On Sun, May 20, 2018 at 11:43 AM, Steven D'Aprano wrote: > Out of those industry standard languages (as ranked by TIOBE, other > methodology may result in other rankings) we find: > > 8/12 have some form of assignment expressions; > (Java, C, C++, C#, PHP, Javascript, Ruby,

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Steven D'Aprano
On Sat, May 19, 2018 at 04:28:10PM -0700, Mike Miller wrote: > > On 2018-05-19 06:41, Steven D'Aprano wrote: > >Details follow below. > > Thanks for this, had some more time to read it more closely. Correct me if > I'm probably wrong, but most of these are not used by many. Except perhaps:

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Mike Miller
On 2018-05-19 16:00, Chris Angelico wrote: But you can't put a comparison after the assignment, if it's part of the syntax of the 'if' statement. That's not how grammar works. So you have two options: either the ONLY thing you can capture is the condition value (which you already know to be

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Mike Miller
On 2018-05-19 06:41, Steven D'Aprano wrote: Details follow below. Thanks for this, had some more time to read it more closely. Correct me if I'm probably wrong, but most of these are not used by many. Except perhaps: - Typescript, which is constrained by a compatibility goal with

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Chris Angelico
On Sun, May 20, 2018 at 8:56 AM, Mike Miller wrote: > > On 2018-05-18 19:14, Chris Angelico wrote: >> >> Yes, largely because it's insufficient for all but a small handful of >> situations. I mentioned that in the previous email. > > > I'd argue that they are the bulk

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Mike Miller
On 2018-05-18 19:14, Chris Angelico wrote: Yes, largely because it's insufficient for all but a small handful of situations. I mentioned that in the previous email. I'd argue that they are the bulk of occurrences, that's why they've been chosen as the compromise in those languages. Once

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Guido van Rossum
On Sat, May 19, 2018 at 9:40 AM, Mike Miller wrote: > > On 2018-05-19 06:41, Steven D'Aprano wrote: > >> Thanks for writing up the summary, but you have picked a very narrow >> subset of new languages. One might even say a biased subset. How about >> these new

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Mike Miller
On 2018-05-18 18:10, Chris Angelico wrote: The bit that you tag on as an afterthought is actually critically important here. You have two options: 1) The 'as' is part of the syntax of the 'if' and 'while' statements; or This first choice appears the more conservative compromise that several

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Mike Miller
Also meant to mention, I didn't pick them specifically in advance to match a goal. I was mildly surprised at their similar design on that front. -Mike ___ Python-ideas mailing list Python-ideas@python.org

Re: [Python-ideas] Make keywords KEYwords only in places they would have syntactical meaning

2018-05-19 Thread Rob Cliffe via Python-ideas
On 18/05/2018 12:22, Ken Hilton wrote: Hi all, Yes, this is another idea for avoiding breaking existing code when introducing new keywords. I'm not sure if this is too similar to Guido's previous "allow keywords in certain places" idea, but here goes: Only treat keywords as having any

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Carl Smith
> JavaScript and PHP are abysmally designed languages, so we should > put little weight on any precedent they set. JavaScript has issues, due to its unique history, but to dismiss the entire language as too poorly designed to take seriously... Many clever people prefer JS to Python. -- Carl

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Chris Angelico
On Sun, May 20, 2018 at 4:07 AM, Kirill Balunov wrote: > [Chris] > >> The bit that you tag on as an afterthought is actually critically >> important here. You have two options: >> 1) The 'as' is part of the syntax of the 'if' and 'while' statements; or >> 2) The 'as' is

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Kirill Balunov
2018-05-19 3:54 GMT+03:00 Mike Miller : > Background: > > While the previous discussions about assignment-expressions (PEP 572) > (abbreviated AE below) have been raging one thing that was noticeable is > that > folks have been looking back to C for a solution. > > But

Re: [Python-ideas] Escaped braces in format specifiers

2018-05-19 Thread Ken Kundert
On Sat, May 19, 2018 at 07:06:41AM -0400, Eric V. Smith wrote: > On 5/19/2018 1:56 AM, Ken Kundert wrote: > >On Tue, May 15, 2018 at 04:23:26PM -0400, Eric V. Smith wrote: > >>I'm busy at the sprints, so I don't have a lot of time to think about this. > >> > >>However, let me just say that

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Brendan Barnwell
On 2018-05-19 06:41, Steven D'Aprano wrote: TypeScript (2012) - a strict superset of Javascript, including assignment expressions Hack (2014) - a (not quite full) superset of PHP, including assignment expressions Overall your list is fair, and you're right that more languages could be

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Mike Miller
On 2018-05-19 06:41, Steven D'Aprano wrote: Thanks for writing up the summary, but you have picked a very narrow subset of new languages. One might even say a biased subset. How about these new languages? Certainly. I chose basically on whether it was well used (popular), I'd heard about

Re: [Python-ideas] String and bytes bitwise operations

2018-05-19 Thread Steven D'Aprano
On Fri, May 18, 2018 at 06:25:19PM -0400, Chris Barker - NOAA Federal via Python-ideas wrote: > > I suppose you could argue that a "byte" is a patch of > > storage capable of holding a number from 0 to 255, as opposed to being > > the number itself, but that's getting rather existential :) > >

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Steven D'Aprano
Thanks for writing up the summary, but you have picked a very narrow subset of new languages. One might even say a biased subset. How about these new languages? Elixir, Elm, TypeScript, Hack, Julia, Perl6, Ring, LiveScript, Ballerina, Crystal, Opa, Red, Ceylon TL;DR At least 10 out of these

Re: [Python-ideas] Escaped braces in format specifiers

2018-05-19 Thread Eric V. Smith
On 5/19/2018 1:56 AM, Ken Kundert wrote: On Tue, May 15, 2018 at 04:23:26PM -0400, Eric V. Smith wrote: I'm busy at the sprints, so I don't have a lot of time to think about this. However, let me just say that recursive format specs are supported, to a depth of 1. width=10

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Steven D'Aprano
On Sat, May 19, 2018 at 02:11:38PM +1200, Greg Ewing wrote: > Chris Angelico wrote: > >The 'as' syntax has been hammered out in great detail and is no longer > >recommended due to its negative interactions with existing constructs. > > Allowing it in arbitrary expressions has been ruled out on >

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Chris Angelico
On Sat, May 19, 2018 at 4:12 PM, Greg Ewing wrote: > Paul Svensson wrote: > >> I don't quite get what's so subtle about it, am I missing something? >> >> The "with" keyword calls "__enter__", and "as" gives it a name. >> >> Just like "-x + y" is different from "-(x +

Re: [Python-ideas] Modern language design survey for "assign and compare" statements

2018-05-19 Thread Greg Ewing
Paul Svensson wrote: I don't quite get what's so subtle about it, am I missing something? The "with" keyword calls "__enter__", and "as" gives it a name. Just like "-x + y" is different from "-(x + y)", I think the difference is that mentally one already tends to think of "with x as y"