News for hackers. Stuff that matters.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by elnygren on Sunday May 07, 2017 @02:40PM (#14286832)
Python3 is a totally different beast nowadays from Python2.

The reason is async/await. It can handle Node.js style event loop / asynchronous code very well -- with uvloop, python 3.5+ is actually faster than Node.js (close to Go).

https://magic.io/blog/uvloop-blazing-fast-python-networking/

IMHO: after 3.5, we are clearly in the next iteration of the language.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by Animats on Sunday May 07, 2017 @04:51PM (#14287589)
IMHO: after 3.5, we are clearly in the next iteration of the language.

After 3.4, which was a stability release. The async stuff and the beginnings of optional typing went in at 3.5. Numbering probably should have gone from 3.4 to 4.0.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by mrout on Sunday May 07, 2017 @06:12PM (#14287996)
Python 3.5 is compatible with Python 3.4. Python 4.0 would be a silly number to use, it implies that there's incompatibility.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by MereInterest on Monday May 08, 2017 @02:05AM (#14289568)
I can't find a source at the moment, but I'm pretty sure that Guido said that python 4.0 would just be the version number that comes after python 3.9. There is no intention of having another break in backwards compatibility, like there was between python 2 and 3.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by mrout on Tuesday May 09, 2017 @12:02AM (#14297650)
He's said 3.10 more recently than that:

https://twitter.com/gvanrossum/status/583346987925278720

Re:Key differences between Python 2.7.x and Python 3.x (2014) by gime_tree_fiddy on Sunday May 07, 2017 @08:25PM (#14288468)
Is it just me, or comparing Python's async/await to Go is misleading. As far as I know, even with async/await, Python is still not multicore.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by xapata on Monday May 08, 2017 @01:21AM (#14289418)
Async IO is solving a different problem than you're complaining about. Python is effectively multicore in nearly every use case. The only trouble is there's no free lunch -- the multicore solution depends on which problem you're facing.

So, what's the issue you're facing?

Re:Key differences between Python 2.7.x and Python 3.x (2014) by stcredzero on Sunday May 07, 2017 @10:16PM (#14288818)
even with async/await, Python is still not multicore.

Even with its channels and scheduler, Go is still not as multicore as Erlang. And I say this as an avid Go user!

Re:Key differences between Python 2.7.x and Python 3.x (2014) by treehau5 on Sunday May 07, 2017 @11:42PM (#14289091)
What does something not being as multicore as something else mean?
Re:Key differences between Python 2.7.x and Python 3.x (2014) by gime_tree_fiddy on Thursday May 18, 2017 @06:15PM (#14371551)
Multicore in the sense that the underlying runtime (for the lack of a better word) scales to multiple cores. Like two threads in python cannot run in parallel (like at the same time, not like second one gets scheduled if first one waits for IO or network), the way a goroutine in Golang does.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by stcredzero on Monday May 08, 2017 @10:48AM (#14291940)
It would be great if the GC was also multicore. As it is, the task of splitting up your application into multiple processes to have more GC still involves too much friction.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by omginternets on Sunday May 07, 2017 @04:48PM (#14287577)
>is actually faster than Node.js

Uhhh I call BS until proven otherwise. Maybe the event loop is faster, but I'm willing to bet the callback code is slower.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by nicoburns on Sunday May 07, 2017 @05:18PM (#14287733)
> Maybe the event loop is faster, but I'm willing to bet the callback code is slower.

This is exactly the case, and the slowdown is pretty noticeable IMO. Still, python 3 is a whole lot better at this than python 2.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by elnygren on Monday May 08, 2017 @04:16AM (#14290018)
The "proof" (benchmarks, yeah, I know) is in the provided link. Feel free to shoot them down.

Anyway, slower or not, writing a small async service is still easier in Node.js. You can trust that no libraries block your event loop and I'm not sure there's quite anything like Express (simplicity+popularity) for async Python just yet.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by omginternets on Monday May 08, 2017 @12:03PM (#14292789)
>The "proof" (benchmarks, yeah, I know) is in the provided link. Feel free to shoot them down.

I just did: those benchmarks show uvloop's performance, not python's, i.e.: they're designed to minimize time spent in callback code.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by tuco86 on Monday May 08, 2017 @02:19AM (#14289623)
the callback code being slower is actually a feature in my opinion.. http://stackoverflow.com/questions/18542484/why-callbacks-ar...
Re:Key differences between Python 2.7.x and Python 3.x (2014) by omginternets on Monday May 08, 2017 @12:07PM (#14292838)
I'm struggling to see where in the wall of text this notion is supported.

This smells of mental gymnastics.

I'm a huge fan of python (though I much prefer twisted to aio), but slower callbacks are unequivocally worse than faster ones, all other things being equal (which of course, they never are).

Re:Key differences between Python 2.7.x and Python 3.x (2014) by xapata on Monday May 08, 2017 @01:18AM (#14289408)
Depends on many things. What task are you trying to accomplish?
Re:Key differences between Python 2.7.x and Python 3.x (2014) by omginternets on Monday May 08, 2017 @02:25PM (#14294217)
In any non-contrived example, CPython's callback code will be slower than equivalent JIT-ed code from v8.

Please don't play the "it depends" card just to be smug. It lowers the level of discourse.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by xapata on Wednesday May 10, 2017 @04:47AM (#14306810)
I ain't being smug. If I were, I might use fancy words like "discourse". But we're not playing cards here, are we?

JIT-ed code can be pretty fast, but so can calls to libraries like NumPy. PyPy can also be somewhat speedy, though it hasn't had as much dev time as v8. And if you somehow find yourself breaking new ground with an algorithm no one's written a fast implementation of yet, there's always Cython.

Besides, if there's any task that takes more than a negligible amount of time, I usually push it to a different process and respond immediately. The callback speed in that case is bound by the time it takes to write to a message queue or append to a database table, not the language itself.

Re:Key differences between Python 2.7.x and Python 3.x (2014) by Rapzid on Sunday May 07, 2017 @07:51PM (#14288340)
The Python async story appears to be a bit of a mess though. There was some discussion recently on this here: https://news.ycombinator.com/item?id=14240125 .
Re:Key differences between Python 2.7.x and Python 3.x (2014) by jodrellblank on Sunday May 07, 2017 @09:02PM (#14288579)
And this discussion less recently: https://news.ycombinator.com/item?id=12829759 "I don't understand Python 3 asyncio". Along with the comment somewhere in that thread by coleifer:

"I've been a gevent user for a long time and Python's decision to "bless" twisted by adopting it's patterns was a watershed moment for me, and basically was the beginning of the end of my belief that I'd ever adopt Python 3.

User jerf's comment that asyncio "more than [doubles] the complexity" is absolutely correct. Watch this video of Guido talking about tulip...or struggling to talk about tulip, rather. It's clear the dude is out of his depth and my god the recent changes to the language show that the inmates are now running the asylum... Seems like Python, in it's effort to chase the latest fads, is no longer the language I would endorse to someone new to programming. Whether you think that's a meaningful litmus test or not, the staggering amount of _crap_ that's infiltrated the language now completely flies in the face of the zen of python's statement that there should be one and preferably only one way of doing things. Fuck. I'm going to go code some lua now.

https://www.youtube.com/watch?v=1coLC-MUCJc "

Re:Key differences between Python 2.7.x and Python 3.x (2014) by Rapzid on Sunday May 07, 2017 @11:56PM (#14289137)
They have managed to take the async/await pattern and make it as much fun as Perl POE.
Re:Key differences between Python 2.7.x and Python 3.x (2014) by anonymoushn on Sunday May 07, 2017 @07:56PM (#14288370)
We did this in python 2 with greenlet. It's cool that people can do it today by writing "async" in a thousand different places though!
Re:Key differences between Python 2.7.x and Python 3.x (2014) by kccqzy on Sunday May 07, 2017 @03:07PM (#14286988)
I haven't written Python in a few years, and recently when I needed to read some Python code thinking it would be familiar, I am completely unprepared to see async/await peppered everywhere. It is indeed a big change.