11 ms·
Python 3.4.0 released
- Watabou 13y agoWow, pip bundled by default. Very interesting.
- rectangletangle 13y agoHaving pip and venv bundled with the standard distribution is convenient.
- Watabou 13y agoYeah, I'm hoping this will make it easier for people to upgrade to python 3.
- tachion 13y agoDoesnt including those in distribution slows the pace at which they'll be developed and released?
- babarock 13y agoI don't want pip and virtualenv to be constantly changing and evolving. We finally reached a stage where they're usable reliably. Some stability wouldn't hurt.
- tshepang 13y agoIt's just bundled, meaning it's still developed externally. In fact, 3.4.1 will include a newer pip version.
- donaldstufft 13y agoAssuming we've released a newer version of pip when 3.4.1 is released :)
- baq 13y agothis, unicode and exceptions are IMHO good enough to start thinking about upgrading. you might say that pip is a non-issue because everybody who develops in python has it installed anyway, but in windows world deploying python apps has always been a pain (yes, i use py2exe, it's not perfect).
- raverbashing 13y agoNo, the Pip issue is huge This makes a proper P3 Virtualenv into something good (from something barely ok in 3.3 where you need to install setuptools manually in your virtualenv)
- jeffbr13 13y agoSurely you could just install Python3 and pip systemwide, then ask virtualenv/virtualenvwrapper to use that one? virtualenv -p $(which python3) ENV # with virtualenv mkvirtualenv [-a project path] -p $(which python3) ENVNAME # with virtualenvwrapper
- raverbashing 13y agoDid you actually try that? No, it doesn't work Python 3 comes with pyvenv that's the one that should be used
- pdw 13y agoHow does it break? I've always used virtualenv -p /path/to/python3 and it seems to work fine.
- raverbashing 13y agoJust tried this with virtualenv and pyvenv-3.4 and they don't produce identical results. The good thing about 3.4 is that they finally give a good virtualenv by default and we don't need to install setuptools/pip inside manually
- unfamiliar 13y agoIs pip actually included by default, or just an installer for pip?
- donaldstufft 13y agoBoth kind of! Added to the stdlib was "ensurepip", which is a simple installer for pip. The ensurepip module includes inside of it a copy of pip that it will install from (in other words, ensurepip doesn't hit the network). There are various reasons why it does this, part of which is to enable easy upgrades to newer versions of pip both inside of CPython itself, and for the end user to upgrade it locally.
- gangster_dave 13y agoCool. I love Python, but it's really going to be a decade before this interpreter is used in production by anyone.
- broodbucket 13y agoPython 3 came out in 2008. You're saying 16 years post-release until a moderately sized change (the majority of which is regarded as improvements) to a language is used in production. That's totally bonkers.
- levosmetalo 13y agoAnd people complain about slow Java upgrade cycles ;)
- natmaster 13y agoJava doesn't release anything new for 8 years. Whereas in python world some people don't upgrade for 8 years.
- pjmlp 13y agoStill better than 13 years for C++11 or having to wait around 6 years for the availability across all major compilers of what might be C++17 (looking at you modules).
- deong 13y agoI'm not sure it is. With C++, you can just start to work. There's no one saying "C++-11 is completely different and not at all compatible with the previous version, so you'll need to port all your existing code. Oh, and we're not going to support the old version anymore. Except we sort of will. But not. Kind of." I like both languages actually, and I use python quite a bit, but holy crap has python 3 been a train wreck. C++ moves slowly, but predictably. Python has two active versions: one you're not supposed to use and one you can't.
- deckiedan 13y agoFunny, 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 13y agoWhat 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?).
- rjbwork 13y agoC#/.NET/PowerShell has some decent path abstractions. You still usually create the initial object via a string at some point though...
- ygra 13y agoAs far as I know it's always a string. You just have a bunch of helper methods to handle "path strings". But they're still strings, not Path objects (or File, like in Java).
- est 13y ago> I wonder how many other languages already had abstractions for this (smalltalk ? ruby?). I remember VBScript/JScript with FileSystemObject decades ago. It's from COM
- agumonkey 13y agoFSO is more a Class wrapping the usual FS functions, it still pass around raw string IIUC.
- gnur 13y agoAsyncio 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?
- DanWaterworth 13y agoI've been using asyncio in the last week. I've found it remarkable clean and intuitive. It's difficult to compare to channels in go, because it's such a different solution to the same problem - that of structuring concurrent programs.
- babarock 13y agoIf anyone's interested in testing out Asyncio/Tulip on Python 2, here's a mostly-compatible backport: https://pypi.python.org/pypi/trollius/ https://pypi.python.org/pypi/trollius/
- dalke 13y agoThey 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 13y agoI 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).
- waitingkuo 13y agoIt'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.
- rhizome31 13y agoNice to see single-dispatch generic functions coming to the standard library. That will help making some pieces of code simpler and more readable.
- babarock 13y agoHere's a good explanation of this technique: http://julien.danjou.info/blog/2013/python-3.4-single-dispatch-generic-function http://julien.danjou.info/blog/2013/python-3.4-single-dispat...
- ubertaco 13y agoNice! That's something I like about Haskell and Elixir: the ability to define behavior for a given case. Though it looks like that's constrained to type-based dispatch (a la Java method overloading). Is there any way to define for specific values?
- hyperpape 13y agoIf I read this article properly, there's nothing yet standardized, but there's a possibility of future development: http://lukasz.langa.pl/8/single-dispatch-generic-functions/ http://lukasz.langa.pl/8/single-dispatch-generic-functions/.
- bcoates 13y agoIf 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.
- hyperpape 13y agoI had a hard time understanding the value of the idea from this as well. The link I gave made it a bit clearer to me.
- 13y ago
- nichochar 13y agoThat statistics module makes me happy too
- MisterMashable 13y ago...and Google App Engine still uses 2.7
- pfalke 13y agoAre 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 13y agomy $$ 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 13y agoAgreed. 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 13y agothat sounds about right. I wasn't thinking about it from the technical end. I was just speculating the business angle.
- agentultra 13y agoGlad 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-objects http://ccl.clozure.com/ccl-documentation.html#watched-object...
- illumen 13y agotldr; '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.
- cschmidt 13y agoIt 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
- ggchappell 13y agoOr maybe Introselect, which does Quickselect, but switches to Median-of-Medians (i.e., BFPRT) if the recursion depth gets too big. It has the average-case performance of Quickselect, but, like M-of-M, requires only O(n) comparisons when given a list of length n.
- schmichael 13y agoI'm sure patches would be accepted as there's no reason the implementation of the function has to remain identical over releases.
- cschmidt 13y agoI 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 13y agoI'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.
- adidash 13y agoSo 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?
- mildtrepidation 13y agoThat depends. If you intend to work on other people's code or currently-active projects (or anything likely to be active soon), starting with 2.7 and learning the differences later would be a good approach. If you're just using it for its own sake, or only for building things locally that either don't need to run anywhere else or only need to run where you have enough control to install your own Python, and you don't and won't need dependencies that aren't currently ported... then definitely start with 3.x. :)
- e1ven 13y agoI 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.
- takeda 13y agoYes, there's nothing you will gain by starting with 2.7. The language is polished, majority of modules are ported (currently from those that matter only twisted and opencv isn't). If you for some reason have to work on older version (for example RedHat still uses 2.6) knowing Py3 is not really an issue to program there. Of course few nice features are missing, but people seem to talk as if it is a completely different language for some reason. With Python 3 at least you have a nice more consistent language. If you were learning Java, would you start with JDK 1.3 or the latest one?
- yizzerin 13y agoThere's very little difference between the two (a few standard library differences at most + a little syntax). 3.4 (and Python 3 generally) is the future of Python. Learn it first and you'll be on good footing.
- DonGateley 13y agoWhen there's a release with a bullet item saying "Full compatibility with 2.7 libraries" I'll get interested.
- JoachimS 13y agoGood 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/