10 ms·
IMO the biggest reason to use Python3 is its concurrency support via async + await. Fixing the unicode mess is nice too of course, but you can get most of the
by rkrzr 11y ago
IMO the biggest reason to use Python3 is its concurrency support via async + await.
Fixing the unicode mess is nice too of course, but you can get most of the benefits in Python2 as well, by simply putting this at the top of all of your source files:
from __future__ import unicode_literals
Also make sure to decode all data from the outside as early as possible and only encode it again when it goes back to disk or the network etc.
- tudborg 11y agoSo much this! asyncio was the main selling point for me, but in general, why not follow the language? I never really understood the "rather stay with py2.7" thing. I get it with big old monolithic applications. You don't "just" rewrite those, but _every new python project_ should be done with the latest stable release. Is anyone starting their PHP projects on PHP4? Any new node projects in 0.10? Of course not, that would be moronic.
- netheril96 11y agoBecause you don't know what libraries you may depend on in the future when you start a new project. I was a fervent Python 3 supporter, and wrote every of my fresh projects in Python 3 instead of 2, until one day I found I needed LLVM in my project, yet the python port at that time was for 2 only. I mostly avoid writing Python 3 nowadays, because I don't want to rewrite my project or find painstakingly an alternative solution when I could have just imported a module that runs fine under Python 2.
- ak217 11y agoFor the record, you do not get most of the benefits by doing the future import. The silent Unicode/bytes coercion and lack of standard library support is still there, making it almost impossible to write correct non-ascii-handling software in Python 2.