5 ms·
So what's the deal with Python these days? Do people still write for 2.7 which is the default "python" in most (all?) Linux distributions, or is it safe to writ
by null_ptr 13y ago
So what's the deal with Python these days? Do people still write for 2.7 which is the default "python" in most (all?) Linux distributions, or is it safe to write for python3 now?
- viraptor 13y ago> Do people still write for 2.7 Yes. > which is the default "python" in most (all?) Linux distributions Most distributions ship both 2.x and 3.x at the same time. Ubuntu ported most (all?) of its tools to 3.x already. > is it safe to write for python3 now? What do you mean by safe? It's been stable for a long time now. As long as you verify all your dependencies work, you should be fine. The only annoying thing you may run into is a situation where only one of the versions is provided: for example if you want to drive ufw (3.x only) from salt (2.x only), you'll have to resort to some kind of IPC instead. There was a poll about the current state a month or two ago on HN.
- wfn 13y agoAlso, python3 is the default in archlinux: https://wiki.archlinux.org/index.php/python https://wiki.archlinux.org/index.php/python
- stefantalpalaru 13y agoArch Linux is an exception because they blindly follow upstream.
- raverbashing 13y agoYes, Python 3.3 is absolutely fine, I wouldn't bet on 3.2 or anything earlier though.
- yeukhon 13y agoYes. Like any other Python 2 releases, there are always new syntax and function additions. I think the only major Python library people use not available on Python 3 is Twisted. (edit: I think Mercurial is also not compatible with Python 3 IRRC due to byte-string and unicode incompatibility). Even Tornado and pyCurl works with Python 3 (according to pypi and doc). Before you start writing in Python 3, make sure your dependencies will run on Python 3.
- leobelle 13y agoTwisted is a library you might want to use if you want to write non-blocking code. So you would care a great deal if this wasn't python 3 if you wanted to use python 3. Mercurial is an application you use to version control your source. I'm not sure I understand why any python developer would care if Mercurial was written in python 2 as long as it worked. Maybe if someone was writing a Mercurial plugin or patching Mercurial they would care.
- erichurkman 13y agoOutdated packages matter insofar as that you must maintain a working 2.x install alongside your 3.x if you use tools that need 2.x. Hopefully these start disappearing, as Ubuntu and Arch have already moved to 3.x.
- leobelle 13y agoThis has very little to do with Python developers deciding between version 2.7 and 3.x. If you wrote a library or an app in Python 3.x packagers should require the appropriate version of Python as a dependency. Sam with v2. Developers shouldn't worry about that.
- nostrademons 13y agoPython 3.4 comes with asyncio, which takes a lot of the ideas of Twisted but forward-ports them to the standard library with cleaner language support. So for new projects, Twisted shouldn't hold you back - just use the standard lib. For legacy Twisted projects that are thinking of porting it's still an issue.
- yeukhon 13y agoStandard library doesn't always make things easier. We have urllib but do we recommend requests for doing http requests? So either Twisted is ported or someone else write a new Twisted-like (but simpler?). I know Guido doesn't like callback-style programming.
- rogerbinns 13y agoAmazingly people still use Python 2.3. With source downloads you can't tell what platforms use, but you can with binary downloads. One of my projects is a Python wrapper for SQLite (APSW) for which I also provide compiled Windows binaries for every Python version from 2.3 to the latest, and 64 bit for some of them too. It is very amusing to me that some people want the latest SQLite while using a positively ancient Python version. Google code shows download counts so you can get an idea of popularity of each release for Windows developers: https://code.google.com/p/apsw/downloads/list?can=1&q=&colspec=Filename+Uploaded+DownloadCount https://code.google.com/p/apsw/downloads/list?can=1&q=&colsp... I've since moved the project to github which doesn't show the download counts for releases. https://github.com/rogerbinns/apsw/releases https://github.com/rogerbinns/apsw/releases
- ambiate 13y agoWe still use python2.0-2.5. Various versions for various libraries. It is hell.
- zem 13y agodefinitely not all distributions, arch has 3.x as default and 2.7 as python2
- wylee 13y agoI think it's pretty safe to go with Python 3 for new and/or personal projects. I started moving all my stuff to Python 3 a few months ago and Fabric is the only major project I use that hasn't been ported.
- thomasahle 13y agoIt's actually getting a lot better. Many distributions ship python3 as the default python now, and even libraries like numpy and interpreters like pypy support it.