Live data from Hacker News

What's Coming in Python 3.8

lwn.net

281–290 of 558 posts

Re: What's Coming in Python 3.8

#281

Earlier quoted context omitted.

Python 2.7 is not far from that language.

What's stopping people from forking the language at python 2.7? Let the pythonistas add whatever feature they feel like while people who need stability use "Fortran python" or whatever.

I truly wish this would become a thing. It's really frustrating having to update my installed packages and my code for some stupid change the language designers thought is sooo worth it. Just stabilize the bloody thing so I can do some work. Updating code so it meshes with the "latest and greatest" is _not real work_.

Re: What's Coming in Python 3.8

#283
post #18

Earlier quoted context omitted.

I write a good deal of python and I can't think of a line of code that I would use it for besides the while loop on a non-iterable data source, which is such a once in a blue moon case. As mentioned by others, the operator invites more ways to do the same thing, which is not what Python has been viewed as being about.

Victor Stinner made a demonstration pull request using the walrus operator in the standard library where it makes sense. On balance it removes several hundred lines and often makes the code much clearer, e.g. https://github.com/python/cpython/pull/8122/files#diff-78e8e...

The argument was about mostly about the syntax.

In the link above, the "as" keyword would work with (very close to) all of those lines and arguably more readable.

Re: What's Coming in Python 3.8

#285
post #5

Walrus operator looks like a great addition, not too much syntax sugar for a common pattern. Why were folks arguing about it?

It's the most controversial feature ever introduced because it goes against a lot of python culture and philosophy. All in all the debate has been heated and long, but it has been decided that the python community will use it intelligently and rarely, but that when it matters, it can help a lot. I'm against this feature, while I was pro f-string. However, I'm not too worried about missuse and cultural shift because I…

Lesson: Reverse 25 year-old design decisions at your own peril.

Re: What's Coming in Python 3.8

#286

Earlier quoted context omitted.

You will end up with the same code under two conditions: 1. You read more than one line of code. 2. Executing the code in the conditional more than once doesn't matter. If you meet those two assumptions, then the reading I suggested will transform this if x := y(): act_on(x) into this if y(): act_on(y()) which is, in fact, the same thing.

That second point is quite an assumption to make. If it's okay to end up with the second one of your examples (without the ":=" operator), why did we need to add the walrus opeprator at all? And if you're referring to this statement from your original comment: > If variable_name, the substring from 3 to 5, is "fg", crash. I don't find this to be a clear statement at all. If I read this aloud to any of my programming…

> If it's okay to end up with the second one of your examples (without the ":=" operator), why did we need to add the walrus operator at all?

A couple of reasons:

- The walrus eliminates a line of code in the very common scenario where you would prefer not to recalculate (or retype) y().

- The walrus makes it easy to avoid recalculating y() in the less common scenario where you need to avoid doing that.

> I don't find this to be a clear statement at all.

Nonetheless, it is the normal English syntax used to name something and then immediately define the meaning of that name. If you want to map the Python structure to an equivalent English structure, that is the equivalent English structure. ("Thomas Jefferson, the third president, was a man about whom much can be said.") If you want to map the Python code to an English statement of what the code does, use the reading I first suggested, "if y(), do something with it". If you want to dictate Python code to an English speaker, use the reading "if x colon-equals y()".

So let me ask you: is the problem you'd like to solve "I want to understand what this code does", is it "I like thinking about English grammar", or is it "I'm too busy to type my own code; that's what my secretary is for"?

Re: What's Coming in Python 3.8

#287
post #8

Python looks more and more foreign with each release. I'm not sure what happened after 3.3 but it seems like the whole philosophy of "pythonic", emphasizing simplicity, readability and "only one straightforward way to do it" is rapidly disappearing.

My first though was the same as the snarky sibling comment, but after reading TFA I realized these are all features I've used in other languages and detest. The walrus operator an complex string formatting are both character-pinching anti-maintainability features.

Re: What's Coming in Python 3.8

#288

I long for a language which has a basic featureset, and then "freezes", and no longer adds any more language features. You may continue working on the standard library, optimizing, etc. Just no new language features. In my opinion, someone should be able to learn all of a language in a few days, including every corner case and oddity, and then understand any code. If new language features get added over time, eventua…

Lua is pretty close, and pretty close to Python in terms of style and strengths.

Edit: I actually forgot about the split between LuaJIT (which hasn’t changed since Lua 5.1), and the PUC Lua implementation, which has continued to evolve. I was thinking of the LuaJIT version.

Re: What's Coming in Python 3.8

#289

Earlier quoted context omitted.

To be fair, Guido stepped down because of the way the community reacted. "The straw that broke the camel’s back was a very contentious Python enhancement proposal, where after I had accepted it, people went to social media like Twitter and said things that really hurt me personally. And some of the people who said hurtful things were actually core Python developers, so I felt that I didn’t quite have the trust of the…

It's really disappointing that people could get so worked up, over what is essentially deciding which color to paint the shed, that they chase off the project founder. I wonder if there is any way for open source communities to effectively promote the "take a step back and remember what really matters in life" approach to conflict resolution.

Guido wasn't chased off, he is still in the core group. He just isn't BDFL anymore -- which, from a certain point of view, might be the best of both worlds. As a long-time python user and small-time advocate, I felt the walrus was a really bad decision.

Re: What's Coming in Python 3.8

#290
post #24

Earlier quoted context omitted.

“I've come up with a set of rules that describe our reactions to technologies: 1. Anything that is in the world when you’re born is normal and ordinary and is just a natural part of the way the world works. 2. Anything that's invented between when you’re fifteen and thirty-five is new and exciting and revolutionary and you can probably get a career in it. 3. Anything invented after you're thirty-five is against the n…

It's wrong to frame this as resistance to change for no reason. See my other comment. I see some of this stuff as repeating mistakes that were made in the design of Perl. ...but there are quite few people around these days who know Perl well enough to recognize the way in which history is repeating itself, and that has at least something to do with age.

Me, I am old enough to know Perl, and I've got plenty of one-line skeletons in my own closet. And it more-or-less entered the world already vastly more TMTOWTDI-y than Python is after 3 decades.

FWIW, I tend to think of comparisons to Perl as being a lot like Nazi comparisons, only for programming languages. And I do think there's some wisdom to the Godwin's Law idea that the first person to make a Nazi comparison is understood to have automatically lost the argument.

It's just that, at this point, Perl is both so near-universally reviled, and so well-understood to be way too optimized for code golf, that any comparison involving it is kind of a conversation-killer. As soon as it shows up, your best options are to either quietly ignore the statement in which the comparison was made, or join in escalating things into a flamewar.

Post reply on HN