Despite controversy, walrus operator is going to be like f-strings. Before: "Why do we need another way to..." After: "Hey this is great".<p>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.
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.
To me, the headline feature for Python 3.8 is shared memory for multiprocessing (contributed by Davin Potts).<p>Some kinds of data can be passed back and forth between processes with near zero overhead (no pickling, sockets, or unpickling).<p>This significantly improves Python's story for taking advantage of multiple cores.
I long for a language which has a basic featureset, and then "freezes", and no longer adds any more language features.<p>You may continue working on the standard library, optimizing, etc. Just no new language features.<p>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 <i>any</i> code.<p>If new language features get added over time, eventually you get to the case where there are obscure features everyone has to look up every time they use them.
Speaking as someone who has written Python code almost every day for the last 16 years of my life: I'm not happy about this.<p>Some of this stuff seems to me like it's opening the doors for some antipatterns that I'm consistently frustrated about when working with Perl code (that I didn't write myself). I had always been quite happy about the fact that Python didn't have language features to blur the lines between what's code vs what's string literals and what's a statement vs what's an expression.
There's a lot of talk in this thread about Python going down-hill and becoming less obvious/simple. I rather like modern python, but I agree that some features (like async/await, whose implementation fractures functions and libraries into two colors [0]) seem like downgrades in "Pythonicity".<p>That said, I think some things have unquestionably gotten more "Pythonic" with time, and the := operator is one of those. In contrast, this early Python feature (mentioned in an article [1] linked in the main one) strikes me as almost comically unfriendly to new programmers:<p>> Python vowed to solve [the problem of accidentally assigning instead of comparing variables] in a different way. The original Python had a single "=" for both assignment and equality testing, as Tim Peters recently reminded him, but it used a different syntactic distinction to ensure that the C problem could not occur.<p>If you're just learning to program and <i>know nothing</i> about the distinction between an expression and a statement, this is about as confusing as shell expansion (another context-dependent syntax). It's <i>way</i> too clever to be Pythonic. The new syntax, though it adds an extra symbol to learn, is at least 100% explicit.<p>I'll add that := fixes something I <i>truly hate</i>: the lack of `do until` in Python, which strikes me as deeply un-Pythonic. Am I supposed to break out of `while True`? Am I supposed to set the variable before <i>and</i> at the tail of the loop (a great way to add subtle typos that will cause errors)? I think it also introduces a slippery slope to be encouraged to repeat yourself: if assigning the loop variable happens twice, you might decide to do something funny the 2:Nth time to avoid writing another loop, and that subtlety in loop variable assignment can be very easy to miss when reading code. There is no general solution I've seen to this prior to :=. Now, you can write something like `while line := f.readline()` and avoid repetition. I'm very happy to see this.<p>[0] <a href="https://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/" rel="nofollow">https://journal.stuffwithstuff.com/2015/02/01/what-color-is-...</a><p>[1] <a href="https://lwn.net/Articles/757713/" rel="nofollow">https://lwn.net/Articles/757713/</a><p>[edit] fixed typos
Was really hoping to see multi-core in 3.8, looks like we'll be waiting until 3.9<p><a href="https://www.python.org/dev/peps/pep-0554/" rel="nofollow">https://www.python.org/dev/peps/pep-0554/</a><p><a href="https://github.com/ericsnowcurrently/multi-core-python/wiki" rel="nofollow">https://github.com/ericsnowcurrently/multi-core-python/wiki</a>
Without wanting to ignite a debate about the walrus operator (and having not read any of the arguments), I can guess why there was one. It's not clear to me what it does just from reading it, which was always one of Python's beginner-friendlinesses.
Very much looking forward to assignment expressions! It's something I've wanted to do every so often, only to realise that you can't. A worthy addition to the already intuitive Python language.
Have there been any performance benchmarks done on Python 3.8 yet? I'd be interested in seeing how it compares to 3.6 and 3.7, but haven't seen anything published.
Anyone else think the walrus operator is just plain ugly? There is a certain aesthetic quality that I've always appreciated about the Python language and the walrus operator looks like something straight out of Perl or Shell.
I recommend a talk from Pycon 2019, wherein Dustin Ingram explains PEP-572 (aka the Walrus Operator) better than I’ve seen done elsewhere.<p>IMHO, the usefulness of this new operator outweighs the slight learning curve required to get past the awkwardness you will experience when you are first acquainted to it.<p>Here is that talk:<p><a href="https://youtu.be/6uAvHOKofws" rel="nofollow">https://youtu.be/6uAvHOKofws</a>
Also type hints for dictionaries with fixed keys:<p><a href="https://www.python.org/dev/peps/pep-0589/" rel="nofollow">https://www.python.org/dev/peps/pep-0589/</a><p>I know it's almost always better to use objects for this, but tons of code still uses dictionaries as pseudo-objects. This should make bug hunting a lot easier.
Gotta ask how many of these changes are actually reflective of changing environments.<p>I could see with c++ that between 2003 and 2014 a fair few underlying machine things were changing and that needed addressing in the language.<p>But Python is not quite as close to the machine, and I don't see how something like the walrus is helping much. If anything it seems like you'd scratch your head when you came across it. And for me at least one of the main attractions of python is you're hardly ever surprised by anything, things that are there do what you guessed, even if you hadn't heard of them. Function decorators for instance, you might never have seen one but when you did you knew what it was for.<p>Same with the debug strings. That seems to be a special case of printing a string, why not leave it at that? I'm guessing a lot of people don't ever read a comprehensive python guide, what are they going to do when they see that?
It seems like the PEP0505 for None aware operator is delayed indefinitely.<p>It would be great if there was more momentum on this again, as it would be helpful in all sorts of places.<p><a href="https://www.python.org/dev/peps/pep-0505/" rel="nofollow">https://www.python.org/dev/peps/pep-0505/</a>
The lack of the "nursery" concept for asyncio really sucks. Originally I heard it was coming in 3.8. Right now asyncio has this horrible flaw where it's super easy to have errors within tasks pass silently. It's a pretty large foot gun.
":=" is a fairly common operator symbol that I've seen used in other programming languages (e.g. Golang) and in mathematics. But I've never seen it called the "walrus" operator. Its fitting and memorable though, I like it.
The problem with modern Python is that it's trying to recreate C# or Java. Which leaves it with nothing, because it'll only end up an inferior version of the languages/platforms of which it's attempting to duplicate.<p>When I was into Python, I liked it because it was a tighter, more to the basics language. Not having 4 ways to format strings and so forth.
I don't think Python can defeat Java by becoming Java. It'll lose there due to multiple disadvantages. The way Python "wins" (as much as it could at least), is focusing on "less is more". They abandoned that a while ago.<p>My vision of a language like Python would be only 1-way to do things, and in the event someone wants to add a 2nd way, a vote is taken. The syntax is changed, and the old bytecode interpreter handles old scripts, and scripts written with the latest interpreter's bytecode only allows the new syntax. For me that's the joy of Python.<p>I think a lot of people wanted Python's original vision, "one way to do things". If I want feature soup, I'll use what I program in daily. Which I do want feature soup by the way, I just have no need to replace it with another "feature soup" language like Python turned into because it's inferior on technical and for me, stylistic levels.
I find the different philosophies of languages amazing.<p>Just recently 'Declined Proposal: A built-in Go error check function, “try”' <a href="https://news.ycombinator.com/item?id=20454966" rel="nofollow">https://news.ycombinator.com/item?id=20454966</a> made the front page, explaining how a controversial potential Go feature was being declined early.<p>Python on the other hand, went ahead with what seems to be a proposal at least as controversial as 'try' in Go.
I noticed some changes to pickle; do people still use pickle for Real Work?<p>Potential vulnerabilities aside, I got bitten by some migration issue back in the 2.2 to 2.4 transition where some built-in types changed how they did their __setstate__ and __getstate__ (iirc) and that caused objects picked under 2.4 to not unpickle correctly under 2.2 or something like that. After that I never wanted to use pickle in production again.
I feel like I've been seeing a lot of these almost identical articles pop up all over. Walrus operator, f-string equals, positional-only arguments, <i>yawn</i>. None of that is really going to change your life.<p>There's a bunch of changes in the official "what's new" doc that I think are more interesting:<p><a href="https://docs.python.org/3.8/whatsnew/3.8.html" rel="nofollow">https://docs.python.org/3.8/whatsnew/3.8.html</a><p>* Run-time audit hooks, to see if your modules are making network requests, etc.<p><a href="https://www.python.org/dev/peps/pep-0578/" rel="nofollow">https://www.python.org/dev/peps/pep-0578/</a><p><a href="https://tirkarthi.github.io/programming/2019/05/23/pep-578-overview.html" rel="nofollow">https://tirkarthi.github.io/programming/2019/05/23/pep-578-o...</a><p>* multiprocessing SharedMemory for fast data sharing between processes<p><a href="https://docs.python.org/3.8/library/multiprocessing.shared_memory.html" rel="nofollow">https://docs.python.org/3.8/library/multiprocessing.shared_m...</a><p>* Duck-typing for the static annotation checkers<p><a href="https://www.python.org/dev/peps/pep-0544/" rel="nofollow">https://www.python.org/dev/peps/pep-0544/</a><p>* Literal checking for the static annotation checkers. ie: It's not enough to check that you're passing a string for the mode in open(), you want to check that it's 'r' or 'w', etc.<p><a href="https://www.python.org/dev/peps/pep-0586/" rel="nofollow">https://www.python.org/dev/peps/pep-0586/</a><p>* The compiler now produces a SyntaxWarning when identity checks (is and is not) are used with certain types of literals (e.g. strings, ints). These can often work by accident in CPython, but are not guaranteed by the language spec. The warning advises users to use equality tests (== and !=) instead.<p>* A bunch of speed and memory optimizations:<p>- "Sped-up field lookups in collections.namedtuple(). They are now more than two times faster, making them the fastest form of instance variable lookup in Python."<p>- "The list constructor does not overallocate the internal item buffer if the input iterable has a known length (the input implements __len__). This makes the created list 12% smaller on average."<p>- "Doubled the speed of class variable writes."<p>- "Reduced an overhead of converting arguments passed to many builtin functions and methods. This sped up calling some simple builtin functions and methods up to 20–50%."
I'm all in favor of the walrus operator for the for loop, but the first example given to justify it is code I'd never write. The first if does a return, so there is no need for the else: and indentation. I'm sure there are other code examples that would justify it, but this one is unconvincing.
The title made me think "Be afraid. Be very afraid". But it's all little stuff.<p>Unchecked type annotations remain the worst addition since 3.0. Actual typing might be useful; it allows optimizations and checking. But something that's mostly a comment isn't that helpful.
>Python 3.8 programmers will be able to do: print(f'{foo=} {bar=}')<p>Ugh, how did this get approved? It's such a bizarre use case, and debugging by print should be discouraged anyway. Why not something like debug_print(foo, bar) instead (because foo and bar are real variables, not strings)?
At first, after reading the comments and before reading the article, I thought everyone was just casually bashing because of change. But just look at this :<p>def fun(a, b, /, c, d, *, e, f):<p>or<p>print(f'{now=} {now=!s}')<p>and guess what it does before actually reading the article.<p>Worst, the rationales of the PEPs are weak, presenting improvement for "performances" or enforcement of API because of low level stuff as C.<p>Back when I was 18 years old, Python was high level, rules were simple with only one way of doing things and performances weren't a concern, because you would just use the right language for the right task. There was no enforcement and you could always hack a library to your liking. Python now is getting closer to what Perl looked to me 10 years ago, trying to optimize stuff it shouldn't
Does anyone know the status of pep-582 : <a href="https://www.python.org/dev/peps/pep-0582/" rel="nofollow">https://www.python.org/dev/peps/pep-0582/</a><p>It's still marked as a 3.8 target
I feel like walrus operators, while a cool construct, are at odds with "The Zen of Python".<p>Specifically "There should be one -- and preferably only one --obvious way to do it."<p>If this was any other language, the addition would be welcome, but I feel that the walrus operator fundamentally disagrees with what python is about.<p>It's not about terseness and cleverness, it's about being clear, and having one way to do things (Unless you are Dutch).<p><a href="https://www.python.org/dev/peps/pep-0020/" rel="nofollow">https://www.python.org/dev/peps/pep-0020/</a>
I believe that I hit places where I'd use the walrus about once every few hundred lines of python, so I do see a use for it. OTOH I am worried that it makes the language harder to understand for beginners, and that is a very important role Python plays in the world of programming languages.<p>The abbreviated f-string syntax looks weird and kinda wrong to me. But then I'm not even sure I've got comfortable yet with the object field initialization shortcuts in Javascript and Rust (where you also get to omit stuff to avoid repeating yourself).
>Debug support for f-strings.<p>F strings are pretty awesome. I’m coming from JavaScript and partially java background. JavaScript’s string concatenation can become too complex and I have difficulty with large strings.<p>>Python 3.8 programmers will be able to do:
print(f'{foo=} {bar=}')<p>Pretty cool way to help with debugging. There are so many times, including today, I need to print or log some debug string.<p>“Debug var1 ” + var1 + “ debug var2” + var2...and so on. Forgot a space again.
Is there anything similar to BabelJS for Python?
Now after 3.8 I start to feel there are a need for a tool like that.<p>More compact code at the cost of higher learning curve.
The walrus operator does not feel like Python to me. I'm not a big fan of these types of one liner statements where one line is doing more than one thing.<p>It violates the philosophies of Python and UNIX where one function, or one line, should preferably only do one thing, and do it well.<p>I get the idea behind the :=, but I do think it's an unnecessary addition to Python.
Python has "jumped the shark" for me. Python is no longer Pythonic (the "import this", zen of python easter egg should be removed). It's lost it way and is TIMTOWTDI now, heading for that Perl 6 brass ring. Golang is now the Pythonic language.
What Python needs is a better lambda syntax similar to JS and true anonymous multiline functions. Defining and using lambdas in Python feels very unpythonic, this is something JS gets perfectly.<p>Also fix the GIL.
All I care about is allowing a print statement in addition to the print function. There's no technical reason why both can't coexist in a perfectly usable manner.
I dont like the positional only arguments..<p>Really, I dont like anything that trys to force a future developer into using your code the way you expect them to.