Earlier quoted context omitted.
macOS Sierra today tells me its python is 2.7
And Python 3 is available on macOS Sierra via Homebrew.
New features you can't use unless you are in Python 3
71–80 of 264 posts
Re: New features you can't use unless you are in Python 3
#72Earlier quoted context omitted.
It was source-level incompatible with older code so it couldn't be used as a smooth transition like... almost any other language upgrade I've ever seen. Breaking code like this was a big mistake in my opinion - it resulted in many people sticking on the old version for code and library compatibility. There are still libraries which don't work on Python 3, though now fairly few of them. In addition to that, the unicod…
> It was source-level incompatible with older code so it couldn't be used as a smooth transition like... almost any other language upgrade I've ever seen. Ruby released the source-incompatible Ruby 1.9 just months before Python 3. IIRC most versions of Swift have been source-incompatible with each other. Even a language as buttoned-down as C++ has made source-incompatible changes[1]. I have no idea where people got t…
It's a difference of a few minor things versus a whole swath of changes to the handling of strings in the language, heck, a python 2 print statement isn't compatible with python 3.
These are much more significant breaking changes which make porting code much harder than any of the other examples you've given. For the most part, developers don't have to touch or only have to make minor changes for specific cases to port to Ruby 1.9 or C++11 - look at those C++11 changes for example, so few people were doing those things and they're such bad practices that it simply didn't matter. They successfully preserved compatibility in the nominal case. But even following all the best practices in your Python 2 code will not make it run under Python 3.
Re: New features you can't use unless you are in Python 3
#73Re: New features you can't use unless you are in Python 3
#74Seems that this set of slides (which were very informative!) is for up to 3.5
Re: New features you can't use unless you are in Python 3
#75Open page. Nothing works. Enable their scripts. First slide shows but nothing works - except the link to the pdf version. Why not give a link to the pdf version in a element?
Re: New features you can't use unless you are in Python 3
#76Does anyone use 2.x by choice? I've only seen it required as to not break legacy code.
If you are maintaining a large or important codebase rather than working as a hobbyist or independent contractor, then there is nothing wrong with using older languages/platforms, especially if they are stable and well tested. Avoiding surprises or breakage is generally a lot more important to you than getting a cool new list comprehension facility. Actually, stability of the language is something to be desired, as there is a cognitive cost to having different portions of the project use different language constructs.
In terms of python 2 not being supported in the future, if we are forced to stop using python 2, we'll probably need to switch the project over to Java. Not something I'm looking forward to, but at least the java community doesn't force developers to rewrite their source code when a new JVM comes out. There were some examples of older bytecode not working in newer JVMs, but as long as you had the original sources you could always compile to the newer bytecode. Personally, I've grabbed jars from 2005 and used them without any issue. My employer is mostly a java shop, and I already have to occasionally answer questions from other devs about why this project is in python. My answer has always been that python is a more productive language for this use case, and their retort is that it's not really enterprise ready -- meaning things like stability and support, so that while the language may be faster to initially develop in, the long term maintenance cost will be higher. The lack of respect for backwards compatibility as well as the hostility of the community to basic things like don't break working code is causing me to lose some conviction in my side of this argument. I imagine the same discussion is happening in businesses all over the country.
The question is not python 2 or python 3, but python 2 or move away from the language to one that understands my needs. This transition has created a real black eye for python and its role in the commercial space -- at least that's my impression.
Re: New features you can't use unless you are in Python 3
#77The important stuff that makes a good case for Python 3:
- Adittion of "yield from" allows easier programming with async I/O "a la " Node.js (using 'await')
- Standarized annotations of function arguments and return values can help in the future for type checking, optimization, etc.
Even more important stuff
- Unicode can be used in symbols. You can now use Kanji characters in your function names, to annoy your coworkers and win the International Obfuscated Python Code Contest.
Other stuff
- Minor unimportant stuff that is definitely no reason alone for switching for Python 3.
Re: New features you can't use unless you are in Python 3
#78I did not know you could append to a Path via "/", but that's really awesome! I also really love working with generators when I write Python. They are just such a simple idea that's very powerful and I miss them so much when I go back to javascript (I know javascript has them now, but I haven't written them, and they don't look as fluent as Python 3, where the large parts of the language design is based around them).
I didn't know that too. It's pretty cool. Seems like they overload __truediv__ operator: https://github.com/python/cpython/blob/master/Lib/pathlib.py...
Re: New features you can't use unless you are in Python 3
#79I did not know you could append to a Path via "/", but that's really awesome! I also really love working with generators when I write Python. They are just such a simple idea that's very powerful and I miss them so much when I go back to javascript (I know javascript has them now, but I haven't written them, and they don't look as fluent as Python 3, where the large parts of the language design is based around them).
> I did not know you could append to a Path via "/", but that's really awesome! I didn't know that too. It's pretty cool. Seems like they overload __truediv__ operator: https://github.com/python/cpython/blob/master/Lib/pathlib.py...
Re: New features you can't use unless you are in Python 3
#80Earlier quoted context omitted.
Centos 6 is 7 years old, if you are still using that it is unfortunately your problem. It's not hard to write "python3" on a modern dist. Ubuntu has 3.5 and 3.6 is easily installable though not yet default 3.x.
You think someone is going to start a new project and use a 7 year old OS? I don't think it's "unfortunately my problem" when biz/client reqs for a 7 yo OS are completely out of my hands, unless of course the mindset is "use Python 3 or die trying".
Py 2.6 is already EOL for almost five years.