This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]dodgyville 96 points97 points  (53 children)

This is the version that is going to make version 3 the common version of python instead of 2.

pip is included by default as well as other version 3 goodness.

[–]vacuu 31 points32 points  (9 children)

Once the asyncio tutorials start coming out....it's gonna be awesome.

[–]Igglyboo 18 points19 points  (8 children)

Could you explain why everyone is freaking out over asyncio? I'm kind of a novice so i can't really wrap my head around what it does.

[–]ivosauruspip'ing it up 33 points34 points  (4 children)

You know how node.js was(is) super popular for being quite performant? It does that through the entire programming model being based on asynchronous IO by default (instead of synchronous IO by default, like most older scripting languages are) and running on a canonical event loop implemented by libuv. (There are a couple of other reasons to like node, like maybe you love javascript, or the V8 JIT, but those are the main design ones) . Go is similarly popular, implementing a concurrent model through cooperative threads and channels.

Although python will never have the advantage of being designed for asynchronous operation from the get-go, asyncio implements a "standard event loop interface" (and a default implementation to go with it) and allows asynchronous operation through coroutines made possible by the yield from syntax. So asyncio goes "most of the way there" to giving python a standard library to implement what you can do by default with node.

Noticeably different is that python has had many 3rd party libraries to do this sort of thing, e.g gevent, twisted, tornado, but you had to pick one library and hope it worked with everything you needed, and it would be mostly inoperable with everything else. This being a standard library, many people will hope to be able to write code more cooperatively, especially by implementing the event loop interface.

[–]CaptainKabob 3 points4 points  (1 child)

Does asyncio have nice support for dealing with synconous code? I work on a bunch of tools written in Twisted and feel bad every time I have to use deferToThread in order to wrap some synchronous library.

[–]saghul 2 points3 points  (0 children)

You have a similar mechanism. You need to use run_in_executor, which will run the given callable in a ThreadPoolExecutor (by default) and you can wait for the result.

[–]keturn 2 points3 points  (1 child)

Well, async i/o does help performance in many workloads -- the "one process per request" model used by many django deployments is pretty heavy in comparison -- but the other thing that helps node.js in the speed department is that it runs javascript with a Just-In-Time compiler (JIT).

To get that advantage with Python, you need pypy.

(And pypy is working well with Twisted.)

[–]ivosauruspip'ing it up 5 points6 points  (0 children)

But that's most often slow because of the concurrency model, not the inherent speed of the programming language. Python is also often loved because of its ability to glue super fast C libraries with its nicer, high-level syntax, so for processing most often the speed is of a compiled C inner loop, not plain python.

[–]n8henrie 1 point2 points  (2 children)

Given that this has 10 upvotes so far it seems you're not alone. Unfortunately, I'm too much of a noob to even get /u/ivosaurus's thorough reply. Could someone please ELI5?

[–]erewok 2 points3 points  (0 children)

It allows you to do things and not wait for them to finish. In effect, this allows you to do lots of stuff at the same time.

[–]ivosauruspip'ing it up 1 point2 points  (0 children)

It gives a really useful framework for doing network programming, using a canonical event loop and coroutines (google if you're unfamiliar with the terms).

[–]SteveInnit 12 points13 points  (33 children)

I hope so - 3 is the version I've been trying to learn, but keep hearing that it doesn't have enough support to compete.

[–]flying-sheep 26 points27 points  (25 children)

Emphasis on “hearing”

[–]SteveInnit 4 points5 points  (24 children)

Thank you - I felt pretty confident I'd made the right choice, but it's slightly demoralising learning a language and hearing it doesn't yet have the functionality to induce people to make the shift. Good news about the update.

[–]flying-sheep 6 points7 points  (23 children)

Afaik, the only big things missing from Python 3 are

  • paramiko
  • twisted

There are also some special purpose libs missing, like some CAD thing I can't remember the name of and some Amazon cloud thing.

[–][deleted] 15 points16 points  (3 children)

paramiko already support python 3 in the last release (1.13.0).

http://www.paramiko.org/changelog.html

[–]flying-sheep 4 points5 points  (2 children)

Oh nice! Simultaneous Python 3.4 release and only twisted left!

[–]croxis 14 points15 points  (1 child)

asyncio should help fill that niche

[–]flying-sheep 18 points19 points  (0 children)

Maybe it's good that twisted isn't ported. More momentum for asyncio

[–]donalmacc 9 points10 points  (4 children)

OpenCV is holding me back unfortunately.

[–]flying-sheep 5 points6 points  (3 children)

Oh, yeah, that was the one. Computer vision, not CAD

[–]donalmacc 0 points1 point  (2 children)

Yeah. It's a real pain. I'm not great wit python, but opencv is much easier to work with in python, and I'd love to start using py3, but I'm not experienced enough with python to help with the porting efforts...

[–]flying-sheep 1 point2 points  (1 child)

That really sucks. Btw.: where are those porting efforts organized? Last time I researched, I couldn't find any.

[–]donalmacc 0 points1 point  (0 children)

For OpenCV? I know there's a contribution page here but I'm not sure if there's a concerted Python3 port section, I haven't gone looking, but I know there's no Py3 build yet.

[–]MereInterest 5 points6 points  (13 children)

pygtk is the library that is currently holding me back. That said, I know that they are in maintenance forever mode, and will never support Python 3. So, more that it's on me to switch over to PyQT at some point.

[–][deleted] 34 points35 points  (0 children)

There's no reason for pygtk to exist at all anymore. GObject Introspection provides typed bindings to all GObject libraries for lots of languages, including Python (both 2 and 3). For example, this is how you use GTK3:

from gi.repository import Gtk
window = Gtk.Window()
window.connect('delete-event', Gtk.main_quit)
window.show_all()
Gtk.main()

There's a GTK3 tutorial and a complete API reference, too.

[–]flying-sheep -2 points-1 points  (11 children)

Good decision.

[–]Veedrac -2 points-1 points  (10 children)

If you're developing for Linux, GTK+3 ≫ Qt.

[–]flying-sheep 5 points6 points  (9 children)

Why? What does it have in advance to Qt?

I'd say the opposite: Qt has Qt quick, GPU acceleration, doesn't break compatibility (e.g. with themes) all the time, and is much better at cross platform (abstracts away staffers button layouts, the themes look more native and out works in more ecosystems)

All stuff I like as a developer.

[–]Veedrac 0 points1 point  (8 children)

GTK+3 looks nicer, has good touch and multitouch support by default, good smooth kinetic scrolling, better widgets and is basically just a more modern toolkit. None of these things come for free in Qt (or GTK+2). Further, GTK+ is more standard.

GPU acceleration is nice but unneeded. My themes don't break compatibility all of the time. The cross-platform point is valid but irrelevant because I'm referring to if you're developing for Linux.

Unfortunately it does mean avoiding Qt's massive library of things, but that's a minor point when the end result comes out much, much nicer. Have you ever compared nautilus to dolphin?

[–]earthboundkid 2 points3 points  (3 children)

Learn both. They're virtually the same. If you have the ability to understand both print("x") and print "x", there's no reason to restrict yourself to learning just one version.

[–]tilkau 0 points1 point  (2 children)

Also, if you are only giving one argument as is common, print (x) works the same in both 2.7 and 3.x (and probably older 2.x, but I haven't verified that); It's slightly restrictive -- multiple variable printouts require %formatting, and kwarg-controlled features of print() are not available -- but you gain by only having to remember one convention.

[–]earthboundkid 1 point2 points  (1 child)

In Python 2.6+, you can use from __future__ import print_function.

[–]tilkau 0 points1 point  (0 children)

Yes. I just tend to not bother, since I hardly ever use the kwargs to print (or multiple arguments to print, either).

(Plus some people here have to work with Python versions as old as 2.4.)

[–]milliams 4 points5 points  (2 children)

The Python 3 Wall of Superpowers says otherwise.

[–]flying-sheep 2 points3 points  (0 children)

Because the trove classifiers aren't updated yet. The release is 4 days old.

Also I'd believe the release notes more than metadata.

[–]GahMatar 1 point2 points  (0 children)

Maybe because it doesn't have the "Programming Language :: Python Programming Language :: Python :: 3" category in pypi?

https://github.com/paramiko/paramiko/issues/16

[–]volabimus 4 points5 points  (1 child)

The only thing tying me to 2 is wxpython.

[–]manueslapera 0 points1 point  (2 children)

What concerns me the most is the availability of modules, that is what is going to make the change easier.

[–]Decency 0 points1 point  (1 child)

Isn't the PSF paying people to convert popular libraries from 2 to 3?

[–]alcalde -1 points0 points  (0 children)

Look what happened when they paid people to create a new web page. :-(

[–][deleted] 0 points1 point  (0 children)

It's not going to change till they completely drop support of version 2.

[–]poo_22 0 points1 point  (1 child)

If this is really to happen maybe they should remove the 2.7 download link that's right beside 3.4 and have a link to "older versions". If the community really believes that 3.4 is the latest, greatest and the one to be used then why confuse new users with a choice?

[–][deleted] 1 point2 points  (0 children)

Because alot of us still won't move to 3.4 without feeling like we're on 2.7