Live data from Hacker News

What's Coming in Python 3.8

lwn.net

431–440 of 558 posts

Re: What's Coming in Python 3.8

#431
post #38

Earlier quoted context omitted.

Actually it doesn't violate any of the principles behind the language. It could have been there from day one, like tons of others things added later and now totally loved. I should know, I've worked with Python for 22 years...

Guido disagrees and rejected the idea multiple time in the last 2 decades. I think he worked on Python for a long time too :) This feature is kind of a symbol, the first real decision of the transition between the bdfl and the next era. I'm not worried about it, but yes, it was really against python core principles.

>Guido disagrees and rejected the idea multiple time in the last 2 decades. I think he worked on Python for a long time too :)

Guido also rejected several ideas that would totally fit with Python in those decades. There are lots of concerns (including implementation ones), not just what fits with some hypothetical "Zen", which was never meant as a contract anyway.

Besides Guido finally agreed to it, and even quit because of it.

If Python was to be kept "simple" at all costs, it would have added 20 other things, from operator overloading to yield from over those decades, some far more complex, and non-local than the operator change.

Re: What's Coming in Python 3.8

#432

Earlier quoted context omitted.

The '*' and '/' in function parameter lists for positional/keyword arguments look particularly ugly and unintuitive to me. More magic symbols to memorize or look up.

I also cannot honestly think of a case where I want that behaviour. The "pow" example looks more like a case where the C side should be fixed.

Or where the method should be exposed into several different methods.

Re: What's Coming in Python 3.8

#433

To me, the headline feature for Python 3.8 is shared memory for multiprocessing (contributed by Davin Potts). Some kinds of data can be passed back and forth between processes with near zero overhead (no pickling, sockets, or unpickling). This significantly improves Python's story for taking advantage of multiple cores.

> no pickling, sockets, or unpickling But still copying? If not, then how does it interoperate with garbage collection?

It works with the memoryview/buffer interface, so you can have eg a Numpy array backed by a sharedmemory object attached to a named SM segment.

So it's not for containing normal Python dicts, strings etc that are individually tracked by GC.

https://docs.python.org/3.8/library/multiprocessing.shared_m...

Re: What's Coming in Python 3.8

#434

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…

This is why a lot of scientific code still uses fortran, code written several decades ago still compiles and has the same output. How long has the code which was transitioned to python lasted?

Fortran has added a whole lot of features over time though.

Re: What's Coming in Python 3.8

#435

Earlier quoted context omitted.

> How long has the code which was transitioned to python lasted? A long time. 2to3 was good for ~90% of my code, at least

We will review that statement in 30 years!

Likely, we will review that statement in 2038 at the latest.

Re: What's Coming in Python 3.8

#436
post #118

Despite controversy, walrus operator is going to be like f-strings. Before: "Why do we need another way to..." After: "Hey this is great". People are wtf-ing a bit about the positional-only parameters, but I view that as just a consistency change. It's a way to write in pure Python something that was previously only possible to say using the C api.

I'd used f-string-like syntaxes in other languages before they came to Python. It was immediately obvious to me what the benefit would be. I've used assignment expressions in other languages too! Python's version doesn't suffer from the JavaScript problem whereby equality and assignment are just a typo apart in, eg., the condition of your while loop. Nonetheless, I find that it ranges from marginally beneficial to ma…

I'm trying to write an elisp macro because yes.. f-strings are too convenient

Re: What's Coming in Python 3.8

#437
post #118

Despite controversy, walrus operator is going to be like f-strings. Before: "Why do we need another way to..." After: "Hey this is great". People are wtf-ing a bit about the positional-only parameters, but I view that as just a consistency change. It's a way to write in pure Python something that was previously only possible to say using the C api.

Was the walrus operator really worth "The PEP 572 mess"? https://lwn.net/Articles/757713/ That post makes a few things very clear: * The argument over the feature did not establish an explicit measure of efficacy for the feature. The discussion struggled to even find relevant non-Toy code examples. * The communication over the feature was almost entirely over email, even when it got extremely contentious. There was l…

It may not have been a fair trade, but then it wasn't a trade in the first place. Those all seem to be problems with the process itself, meaning that it could have happened any time a contentious feature came up, this just happened to be the one to trigger the problem.

Re: What's Coming in Python 3.8

#438
post #336

Earlier quoted context omitted.

Python is a little more readable, but both Python and Kotlin are perfectly clear in this case: sorted((u for u in users if u.last_name.startswith("S")), key=lambda u: u.last_name )[:3] If last_name is a function, which it often would be in Python, it gets better: sorted((u for u in users if last_name(u).startswith("S")), key=last_name )[:3] However, I think you probably got the sort key wrong if you're taking the fir…

I disagree this python version is as readable and here’s why. It’s about as many characters but more complex. The Kotlin version performs several distinct actions, each being clear to its purpose. These actions have the same syntax (eg requires less parsing effort). The Python version mixes at least 4 different language syntax/features, being list comprehension, if special form in the list comprehension, keywords, an…

I think you're all fighting for nothing here.

The map filter chaining is obviously simpler, but python code is not that difficult and it's a no brainer task anyway.

Re: What's Coming in Python 3.8

#439
post #310

Earlier quoted context omitted.

Common Lisp seems to tick the boxes. The syntax is stable and it doesn't change. New syntax can be added through extensions (pattern matching, string interpolation, etc). The language is stable, meaning code written in pure CL still runs 20 years later. Then there are de-facto standard libraries (bordeaux-threads, lparallel,…) and other libraries. Implementations continue to be optimized (SBCL, CCL) and to develop co…

The "very compact, never changing" language will end up not quite expressive, thus prone to boilerplate; look at Go. Lisps avoid this by building abstractions from the same material as the language itself. Basically no other language family has this property, though JavaScript and Kotlin, via different mechanisms, achieve something similar.

I like to think that lisp is its own fixed point.

Re: What's Coming in Python 3.8

#440

Earlier quoted context omitted.

Many languages don't distinguish between statements and expressions—in some languages, this is because everything is an expression! I'm most familiar with these kinds of languages. I'm not familiar much with Python, beyond a little I wrote in my linear algebra class. How much does the statement/literal distinction matter to readability? What does that do for the language?

The only reason I can imagine being opposed to it is fear that hordes of bad programmers will descend on the language and litter the ecosystem with unreadable golfed garbage. I obviously don't want that. I don't think anybody wants that. But I also don't think that's going to happen as a result of the recent changes in the language. If anything, I feel like the average code quality in the wild has gone up.

Python being the start language for newbies these days, you already have the hordes of bad programmers. Everyone is bad when they start out, after all.
Post reply on HN