
Python 3.4.0 released - jvm
https://www.python.org/download/releases/3.4.0/
======
deckiedan
Funny, the pathlib functionality is really similar to a saturday morning hack
that I was playing with a few months ago.

Pathlib, asyncio, unicode default, bundled pip and venv...

I do like the look of Python3. It's looking a lot more interesting, the
further along it gets. I still haven't really done anything with it, due to
python2 being bundled with our OSX and Linux workstations, which means
painless installs. This year, however, I do want to start porting my projects
over to Python3 (well, making them run on both, at least...)

~~~
agumonkey
What surprised me is that after a long time with string based path libs, Java
and Python are now moving onto oo based ones. I wonder how many other
languages already had abstractions for this (smalltalk ? ruby?).

~~~
brownbat
Do the docs worry you?

"Note This module has been included in the standard library on a provisional
basis. Backwards incompatible changes (up to and including removal of the
package) may occur if deemed necessary by the core developers."

[http://docs.python.org/3.4/library/pathlib.html](http://docs.python.org/3.4/library/pathlib.html)

~~~
k_bx
Actually, there are incompatible changes ALREADY that affect all my projects.

pathlib in python3 has ".parent" property that returns parent-directory, and
pathlib in master has ".parent(n)" method that returns n levels UP.

That sucks so much.

------
cschmidt
It makes me slightly sad that the median routine just sorts the data, and
looks at the middle. I was hoping for quickselect, which uses 4N comparisons
in the average case.

[http://www.ics.uci.edu/~eppstein/161/960125.html](http://www.ics.uci.edu/~eppstein/161/960125.html)

or maybe Blum, Floyd, Pratt, Rivest, and Tarjan if you're being fancy, which
is 24N comparisons in the worst case (but more than 4N for the average case).

[http://www.ics.uci.edu/~eppstein/161/960130.html](http://www.ics.uci.edu/~eppstein/161/960130.html)

~~~
schmichael
I'm sure patches would be accepted as there's no reason the implementation of
the function has to remain identical over releases.

~~~
cschmidt
I haven't got time at the moment, but I would consider contributing an
implementation in the long run, if no one else does by then. It just shouldn't
be O(n log(n)) when it doesn't have to be.

~~~
jabagawee
I've just spent the morning implementing various "faster" median algorithms,
and it seems that constant factors, function call overhead (for recursive
quickselects), etc make all alternative approaches quite slow. The sort-then-
select approach is pretty damn fast, especially since I also think / am pretty
sure sorted() is implemented in C...

So far I've tried median-of-medians, recursive quickselect, iterative
quickselect tracking indices and partitioning in place, and heapq.nlargest.
The implementation in Python 3.4.0 is both cleaner/easier to read and faster
than anything I can make by an order of magnitude for 10,000 element lists.
I'm sure someone else here can do better than me, but (s)he'd have a hard time
beating CPython, imo.

~~~
schmichael
Not only is sorting a Python list implemented in C, the algorithm was
sufficiently impressive to be picked up by Java for non-primitives:
[http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bfd7abda8f79](http://hg.openjdk.java.net/jdk7/tl/jdk/rev/bfd7abda8f79)

The reason it's for non-primitives is because it's optimized for sorting lists
where comparison is relatively expensive , such as the dereferencing Python
does on every item and Java does for non-primitive items.

Thanks for putting the effort in and testing it! Very interesting results.

------
gnur
Asyncio sounds promising, does anyone with more knowledge know whether it
comes close to Go channels?

Go channels are the only experience I have with concurrent programming, but
when I understood them it quickly became second nature to create everything
using channels. Can techniques like websockets be used now as cleanly as in
Go?

~~~
dalke
They aren't like channels. If you want something like channels, try out
greenlets for CPython, Stackless Python (a modified version of CPython) or
pypy.

~~~
nostrademons
I suspect that you could easily implement channels on top of asyncio -
goroutines = coroutines, hide the yield-from inside 'send', select =
asyncio.wait(return_when=FIRST_COMPLETED).

------
rhizome31
Nice to see single-dispatch generic functions coming to the standard library.
That will help making some pieces of code simpler and more readable.

~~~
babarock
Here's a good explanation of this technique:
[http://julien.danjou.info/blog/2013/python-3.4-single-
dispat...](http://julien.danjou.info/blog/2013/python-3.4-single-dispatch-
generic-function)

~~~
bcoates
If I understand the PEP right, this explanation is missing the part where it's
only useful to extend abstract classes; python classes are open so you can
just add a method to a concrete class to get single-dispatch if that's all you
need. I don't think the example given needs generics at all.

~~~
eurleif
>python classes are open so you can just add a method to a concrete class to
get single-dispatch if that's all you need.

Except then your method shares a namespace with all the other methods defined
on the class, which is ugly, and can cause clashes.

------
Watabou
Wow, pip bundled by default. Very interesting.

~~~
rectangletangle
Having pip and venv bundled with the standard distribution is convenient.

~~~
tachion
Doesnt including those in distribution slows the pace at which they'll be
developed and released?

~~~
tshepang
It's just bundled, meaning it's still developed externally. In fact, 3.4.1
will include a newer pip version.

~~~
donaldstufft
Assuming we've released a newer version of pip when 3.4.1 is released :)

------
waitingkuo
It's time for me to switch to python3! btw, I can't wait for the matrix
multiplication operator which might be released in python3.5.

------
agentultra
Glad to see customizable memory allocators made it in. Now if we could only
take it up a notch and allow the run time to assign custom allocators on
individual objects I could implement something like CCL's _WATCH_ [0] for
Python objects which would make debugging multi-threaded code much easier.

Congrats to the python-core team and thanks to everyone for another great
release!

[0] [http://ccl.clozure.com/ccl-documentation.html#watched-
object...](http://ccl.clozure.com/ccl-documentation.html#watched-objects)

~~~
illumen
tldr; 'watchpoints' in python can do this already(since before clojure
existed), but it's not built into standard pdb.

You could do the allocator yourself with a custom allocator easily. Just
inspect the object type or object id, and in your meta allocator select the
correct allocator.

I'm not sure how that would help you with a CCL style WATCH though...

pdb, with set_trace or conditions on breakpoints could let you WATCH
individual objects. Search google for watchpoints.

------
JoachimS
Good to see that the internal hash function has been replaced with SipHash. It
took quite a while for Python to decide to not try to tweak their own hash
function/PRF. Now Python is on par with Ruby and Perl.

[http://legacy.python.org/dev/peps/pep-0456/](http://legacy.python.org/dev/peps/pep-0456/)

------
nichochar
That statistics module makes me happy too

------
MisterMashable
...and Google App Engine still uses 2.7

~~~
pfalke
Are any plans for Python 3.x on GAE known?

Speculation: A Python 3.x runtime might be the mystery annoucement promised
for the Google Cloud Platform Live event on March 25. Unless it's a Node
runtime?

~~~
tbatterii
my $$ is on a node runtime, assuming google is interested in increasing the #
of people that use it. python 3 would be nice but it probably wont get people
interested like node would.

~~~
pfalke
Agreed. However, Node doesn't really fit their request based abstraction as
Node assumes to have a long running server that holds things in memory (like
Socket.io connections). But I haven't really used Node enough to make
statements like this, so correct me if I'm wrong.

~~~
tbatterii
that sounds about right. I wasn't thinking about it from the technical end. I
was just speculating the business angle.

------
adidash
So is Python 3.4 a good starting option for a newbie to learn coding or should
I stick to 2.7 considering all the courses are still using 2.7?

~~~
e1ven
I find 3.4 much easier to use, personally.

I've written several production apps in it, and the unicode fixes in
particular are a much easier, as well as little things like being able to do
enums.

Ultimately, they really aren't all that different- I think the differences
tend to be overblown somewhat on HN.

If the course/teacher you like only teaches using 2.7, learn that. You can
pick up the changes from 2.7->3.4 on your own pretty easily once you know the
basic language.

------
DonGateley
When there's a release with a bullet item saying "Full compatibility with 2.7
libraries" I'll get interested.

------
gangster_dave
Cool. I love Python, but it's really going to be a decade before this
interpreter is used in production by anyone.

~~~
thomasahle
I find it hard to think of anything that doesn't run on Python3 by now. The
only thing that's still good about Python2 is that it's much faster. I always
hope for a release that addresses that.

~~~
lambda
Twisted is a pretty big dependency. The entire stack that I work on depends
heavily on Twisted, and we use a lot of it, so until it's ready on Pyhon 3,
it'll be hard for us to move.

We also depend on Paramiko, which is also red on the WOS.

~~~
tshepang
1.13, released on 2014-03-14, does support Python 3. It's just someone must
have forgotten to update PyPI metadata to indicate so.

~~~
lambda
Ah, that's good news about Paramiko.

Twisted is a bit of a bigger matter. A lot of the Python 3 tasks have been
closed, but it's a pretty big beast, with lots of corners for bugs to hide in.

