11 ms·
Python 3.3.0 beta 1 released
- henryl 14y agoI hate to be that guy, but the key thing on my mind and the thing that constantly pushes me towards hybrid solutions: performance. Whats the verdict?
- gitarr 14y agoWell you don't get compilation to machine code with Python, but you won't get that with many languages. And the ones that do compile are often a pain to write in. So, I for one always go with "Always use the right tool for the problem at hand.", which means I use Python for most things and something like C for the few things that have to be faster. To answer your question: Python is fast enough for most things. It depends on how and what you are using it for though.
- scott_w 14y agoI don't know about the performance of Python 3.3; although I think that if performance is critical, then you should be looking at something other than Python (or a hybrid solution, as you say).
- dbaupp 14y agoThere a few options that allow you to stay (mostly) in Python: Numpy/Scipy for numerics; using Cython[0]; or using an alternative interpreter (specifically PyPy[1]). (This assumes that your specific use case is covered, e.g. PyPy doesn't support Python 3 yet.) [0]: http://www.cython.org/ http://www.cython.org/ [1]: http://pypy.org/ http://pypy.org/
- sho_hn 14y agoI can't answer you in the absolute, but FWIW, Python 3.3 contains a number of changes that are deep-seated enough to improve performance in a wide variety of applications. The biggest of these changes is likely the new adaptive system for the internal representation of strings which tries to pick a representation most suited to each respective string instead of using a "one size fits all" representation, to minimize the memory footprint and improve cache efficiency. Additional work that happened along side this should also greatly speed up encoding into UTF-8 and -16 and some string operations. Another biggie is the new dict implementation, which should also significantly reduce memory footprint and improve cache efficiency (and keep in mind that object attribute namespaces are dicts, so that also affects all objects).
- deleted 14y ago[deleted]
- obtu 14y agoThere are the improvements sho_hn mentions (string representation and shared dict keys to make objects more compact), but if you need more dramatic improvement, look to PyPy.
- dvirsky 14y agoWasn't cPython going to have some sort of JIT in 3.2 or 3.3? Or did I miss it?
- densh 14y agoI've never heard of any plans regarding JIT in CPython. You might have mixed it up with PyPy or Unladen Swallow. Both of them use JIT to speed up their python interpreters. CPython developers quite often expressed their opinion against having JIT or more sophisticated GC because such changes would make Python interpreter too complex. (See Guido's keynote from last PyCon.)
- the_mitsuhiko 14y ago> I've never heard of any plans regarding JIT in CPython. You might have mixed it up with PyPy or Unladen Swallow. Both of them use JIT to speed up their python interpreters. Unladen swallow was supposed to be in CPython at one point.
- sho_hn 14y agoYou're likely thinking of the PyPy project, which is currently working on adding Python 3 support to their excellent JIT-enabled Python interpreter.
- dvirsky 14y agono no, I'm not mistaking pypy, there was work to merge work from Unladen Swallow into python 3.2, but as someone here wrote, it's been canceled.
- masklinn 14y agoThere was a PEP/branch (p3k-jit) to merge Unladen Swallow into mainline, but the PEP was withdrawn as Unladen Swallow faded to black: http://qinsb.blogspot.be/2011/03/unladen-swallow-retrospective.html http://qinsb.blogspot.be/2011/03/unladen-swallow-retrospecti... http://www.python.org/dev/peps/pep-3146/ http://www.python.org/dev/peps/pep-3146/
- ConceitedCode 14y agoIt's great to see virtualenv apart of python now.
- k_bx 14y agoif only virtualenvwrapper would also somehow got there :)
- mattdeboard 14y agoI am generally opposed to including the batteries for things but in this case I agree. The virtualenvwrapper API and path/folder management is far superior. That being said, maybe that IS the API that's included in this release, I don't actually have any idea.
- saurik 14y agoIt continues to be dissapointing that new releases of Python continue to be useless due to the (I will claim needless and arbitrary, although I could totally argue the other side if forced: I am not ignorant of the reasons, I just disagree with the opinions) decision to make the new builds incompatible with the previous ones (and in some cases for the obvious worse, such as how Unicode is now less correctly handled when iterating filenames in directories). I mean: I do almost all of my "business logic" coding in Python these days, and yet when I hear of a new version of Python it carries as much weight to me as a new version of COBOL (which, honestly, probably has more use cases, and almost certainly more users, than Python 3.x). This is the first time I have simply totally felt stranded by a development environment since Microsoft abandoned Visual Basic and replaced it with "Visual Fred" (aka, Visual Basic .NET): and in that case I had already jumped ship to C++ years earlier. At this point, the cost of trying to get all the libraries I rely on set up on 3.x--especially when a ton of them have decided either 1) to slightly change the semantics of the API "as everything is breaking anyway" or 2) that they are obsolete and that you should use some other newer library if you want 3.x--is sufficiently high that one may as well switch to an entirely different language (in my case, probably Clojure).
- sho_hn 14y ago> It continues to be dissapointing that new releases of Python continue to be useless Useless for you :). Personally, I made the switch to Python 3 some time ago, and couldn't be happier. My dependencies are largely sorted these days, availability on the systems I need to deploy on is no longer an issue either, and I find it to be a cleaner, leaner language makes me more productive overall. Sure, there was a time when I read these 3.x announcements with a sort of weary, frustrated feeling, but now I'm back to feeling like a kid in a candy store and excited at what the new release is going to bring. I realize not everybody has made it to this side of the transition yet, but don't fret it, the day will come, and it's a nice place to be in.
- saurik 14y agoAs I explained, for me that day will only come when I switch out a ton of libraries whose bugs and warts I had to painfully work around, as the maintainers have either left or explicitly replaced with different libraries. I question whether this effort is worth it. I am curious, however, how many libraries you actually rely on, given the ease you seem to indicate you were able to move with. Most of my code is just gluing together libraries, from wrappers for libapt to PDF parsing and generation (for which I actually have to use two different libraries) to database bindings to advanced math. I have pages of import statements in my codebase... Near as I can tell, were I to start fresh and use Python 3, even if all the libraries I currently use were ported, I'd just come across a new use case that causes me to need a new library, and as that library will likely not be ported, I'll just be cursing my decision to have switched. Seriously: switching from Java to Clojure has less potential future regret than switching from Python 2 to 3. Hell: Java to C++ has better backwards compatibility (JNI is actually reasonable, and is easily abstractable).
- est 14y agohttp://docs.python.org/dev/library/ipaddress.html#module-ipaddress http://docs.python.org/dev/library/ipaddress.html#module-ipa... Am I the only one worries that Python is slowly turning into Java? Instead of simple text/string for everything, now Class for everything, with nauty weird ill-defined Exceptions.
- hynek 14y agoEhm, how do you check whether an IP address is inside of a specific network with strings? Or how two networks overlap? How many addresses a network has? Hint: there’s more than /24 networks and IPv6 makes it even more complicated.
- sho_hn 14y agoWhile I don't share the OP's worry, I'm guessing he was thinking of utility functions operating on strings as the alternative.
- hynek 14y agoYou can’t hide the complexity of doing that right but OTOH the ipaddress objects have useful str() methods: >>> str(ipaddress.ip_address('127.0.0.1')) '127.0.0.1' >>> str(ipaddress.ip_address('::1')) '::1' >>> str(ipaddress.ip_network('192.168.42.0/24')) '192.168.42.0/24' But you can do stuff like: >>> ipaddress.ip_address('192.168.42.23') in ipaddress.ip_network('192.168.42.0/24') True >>> ipaddress.ip_address('192.168.41.23') in ipaddress.ip_network('192.168.42.0/24') False or for addr in ipaddress.ip_network('192.168.42.0/24'): print(adds) Etc. I strongly suggest to have a look at http://docs.python.org/dev/howto/ipaddress.html#ipaddress-howto http://docs.python.org/dev/howto/ipaddress.html#ipaddress-ho... to have an overview over it’s functionality – unfortunately the API docs aren’t done yet, but will be for 3.3 final. edit fixed code markup
- sho_hn 14y agoJust for the record, I agree that the problem space is such that a utility class is warranted having written code dealing with IP addresses in the past; I was just speculating about the OP's thoughts :).
- gouranga 14y agoI feel there is too much churn in Python. No-one is ready to say "we're stopping here and bug fixing". It just churns and churns and everyone gets confused. It's too much of a rollercoaster to trust at the moment and I assume this is why a large number of Linux distributions are stuck on 2.6 and 2.7 still.
- mxey 14y agoHow are they stuck? Most offer both Python 2 (as python), and Python 3 (as python3). Which makes perfect sense for a new language revision.
- gouranga 14y agoI mean default instance. It's not so much as stuck but the fact you end up with several versions that are supported eternally: python, python27, python3, python31, python32, python33. That and half of pypi only works on < python3. Even the JDK isn't that bad.
- jmmcd 14y agoNo-one is ready to say "we're stopping here and bug fixing" You didn't notice the moratorium on language changes which was in effect for the last couple of years?
- gouranga 14y agoYes I did, but it's pretty irrelevant as 99%+ of the functionality is in the libraries, not the syntax and ABI.
- monkeyfacebag 14y agoTell that to Java.
- gouranga 14y agoJava APIs rarely change.
- ushi 14y agoLZMA support - YES! I am waiting for this so long. I hope it is not horribly slow.
- masklinn 14y agoThe low-level LZMACompressor and LZMADecompressor are thin wrappers around liblzma, there is no pure-python implementation as far as I can tell. So it should be as fast as liblzma itself.
- andreasvc 14y agoI find it really strange that every compression format gets its own top-level stdlib module. Why not compress.lzma and compress.gzip etc., or even compress.open(..., format="lzma") ? It seems ad-hoc and disorganized to me.
- sigzero 14y agoTry opening a PEP...and volunteering to move them into that namespace. I actually think that is a good idea myself.
- sigzero 14y agoI think 3.3 is going to be an awesome release myself: * Reworking of OS and I/O exceptions * Built-in virtualenv * yield from (proxy generators) * Old Unicode literals allowed (but no-op) Just to name a few...
- nine_k 14y agoYes, finally a 3.x release that made me seriously consider switching from 2.6+.
- ghostrockt 14y agowe can all agree that the decision to make python 3.x incompatible with 2.x has greatly fractured the community. regardless of one's opinion on the matter, this divide is hurting the community. how long until we actually come to resolution on it?
- briancurtin 14y agoWhat resolution do you want to hear?