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

Carl Smith carl.input at gmail.com
Mon May 21 19:22:23 EDT 2018

If the ability to capture a subexpression is given up on, then we are are
down to
just capturing the value of the predicate in if statements. In loops, it is
only the
predicate and iteration index.

If you mashup `if` and `def`, you end up with this mess:

    if get_something() def (value):

And `while` and `def` is no prettier:

    while get_something() def (value, index):

Both ugly, and totally misleading, but being able to accept the values as
params is
nice, and the parenthesis make things clearer and more Pythonic IMO, so
just use `as` but require the names be parenthesised:

    if predicate as (value):

    while predicate as (value, index):

The next options may be a bit too functional-looking, when the suite is not
a function
body, but I thought they read better:

    while predicate pass (value, index):

    if predicate -> (value):

    while predicate yield (value, index):

The main idea is to reuse comma separated params in parens to make the
clearer and to look more like the `def` and `class` grammar.

-- Carl Smith
carl.input at gmail.com

On 21 May 2018 at 22:37, Carl Smith <carl.input at gmail.com> wrote:

> Chris makes a lot of good points regarding *which* languages to look at,
> but
> it seems like that line of enquiry is unlikely to suggest anything more
> than it
> has so far, especially if we're limiting it to languages everyone has
> heard of.
> They either use a keyword, an operator, don't support the feature or
> they're
> wacky.
> If anything, the survey says we need to think outside the box.
> -- Carl Smith
> carl.input at gmail.com
> On 21 May 2018 at 20:11, Chris Angelico <rosuav at gmail.com> wrote:
>> On Tue, May 22, 2018 at 2:43 AM, Mike Miller <python-ideas at mgmiller.net>
>> wrote:
>> > To clarify there were three main criteria, and one minor.  Newer,
>> > popular/becoming industry standard, and designed to address
>> shortcomings in
>> > previous generations.  Finally, the limit of my energy when already
>> working
>> > on a project.
>> Note how not one of your criteria says that the language has to have
>> made the right choice - only that it's made a DIFFERENT choice to
>> languages in a previous generation. So you're heavily selecting in
>> favour of languages that say "hey look, we know better than everyone
>> else does", without actually proving that it's better. There's no
>> shortage of language designers who say "oh look how terrible C is",
>> and when a language designer has a lot of clout behind him (like "apps
>> for this new mobile phone should be written using this language"), it
>> can get extremely popular among people who don't actually have much
>> choice of language - and certainly don't have the option to use C.
>> Much more useful would be to look at languages that (a) work in a
>> field where programmers have ample freedom to choose between
>> languages, and (b) have been around long enough to actually
>> demonstrate that people want to use them. Look through the Stack
>> Overflow Developer Survey's report on languages:
>> https://insights.stackoverflow.com/survey/2018/#most-loved-
>> dreaded-and-wanted
>> A "Wanted" language is one that many developers say "I don't currently
>> use, but I would like to". (It may also be a language that has
>> murdered semicolons. I believe the bounty on JavaScript's head is
>> quite high now.) Go through that list and you'll get an idea of what
>> people wish they could use; then toss out anything that hasn't been
>> around for at least 10 years, because there's a tendency for new
>> technologies to be over-represented in a "Wanted" listing (partly
>> because fewer programmers already know them, and partly because people
>> want to try the latest toys). That may give you a better list of
>> languages to compare against.
>> ChrisA
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180522/6dfd842d/attachment-0001.html>

More information about the Python-ideas mailing list