5 ms·
Legacy python nowadays? I really cannot understand why one would use legacy with a new project. Sorry but I could understand if you had to maintain a legacy co
by sdoering 9y ago
Legacy python nowadays? I really cannot understand why one would use legacy with a new project.
Sorry but I could understand if you had to maintain a legacy code base.
- oxguy3 9y agoPython2 is still what comes installed as stock on many distros. I know Fedora/CentOS ship with it, in part because the package manager Yum/DNF is based in Python2.
- toyg 9y agoThat's not even true anymore. From https://fedoralovespython.org/ https://fedoralovespython.org/ : On Fedora, Python comes pre-installed with first class support for Python virtual environments. It is ready for use straight out of the box. No guessing package names, no installation, just dive in and go. Look: [fedora]$ python3 -m venv env [fedora]$ . env/bin/activate (env) [fedora]$ python ... Note the python3 ... EDIT: wow, 4 downvotes for stating a fact that Fedora developers themselves are shouting from rooftoops. The Python3 hate is strong today.
- OJFord 9y agoBut what's the output of python --version (note not python3)
- maweki 9y agoPEP 394 says that python should point to python2 for the time being. https://www.python.org/dev/peps/pep-0394/ https://www.python.org/dev/peps/pep-0394/
- toyg 9y agoYup, and it will be reviewed and likely changed at some point: This recommendation will be periodically reviewed over the next few years, and updated when the core development team judges it appropriate. So it's likely that at some point between here and 2020, or in 2020 at worst, the recommendation will change. IMHO Python 3 has now reached a level of maturity and backward-compatibility where it can safely take over as system python. It's now shipped by Fedora, which means the next RHEL will also ship it. Updating old scripts should mostly be a matter of grepping and shebanging from python to python2, and there is now no point in procrastinating further with this move.
- Freak_NL 9y agoAny proper Python script starts with a shebang: #!/usr/bin/env python3 This works on all modern Linux distributions today.
- OJFord 9y agoYes, and if you write it like that, the output of `python --version` has direct consequences for the remainder of the script.
- luke3butler 9y agoThe entire project is 89 lines of ES6 JS. Python 2 was just used for four lines of example middleware. You can write middleware in anything that's executable via a terminal window.
- twblalock 9y agoThe majority of the Python programmers I know still use Python 2 for new projects.
- mod 9y agoOut of curiosity, how recently have you touched on that? I was one of them until the last couple of months. I think moving to 3 now makes sense, and it's pain-free in my experience. In 2016 I hadn't made the move yet. And as recently as a couple of months ago, sometimes py2 was still the choice (for instance, Amazon Lambda didn't support 3 yet).
- foxylad 9y agoAnd Google Appengine is stuck on Python 2.
- tuxxy 9y agoI don't believe this for a minute. Sure, lots of Enterprise apps use Python 2 because that was what they could build with. I'm a Python developer and I don't know anyone who doesn't use Python 3 by default. I understand this is purely anecdotal, but it seems outlandish to say that Python devs mostly use Python 2.
- fermuch 9y agoThis is still anecdotical, but most python developers I know would chose py2 if given the choice. It's what they know, and they don't want to change semantics even if it's just changing how you write prints.
- anilakar 9y agoCounter-anecdote: Not a single developer I know wants to touch Python 2 after trying to get Django to work reliably with Unicode. Then again, if your language is completely representable with US-ASCII, you might not have experienced the pain caused by having to unit test pretty much all string operations in your code.
- kamikat 9y agoI've re-written sample script in pure shell code :P The idea is that I'd like to write little to make little things work with IFTTT. Py2 is just enough to do a lot while keeping things casual and of fun. Py3 is too serious to me and shell script just awful... Happy hacking.