by chimeracoder · 12y ago · 0 comments
When I first learned Python, I learned Python 3 first because it was newer, and I figured everyone would be using it soon enough. Little did I know that Python 2 would continue to be supported for over ten years after that!
Some people make a big deal about figuring out "which" Python to learn - that's not really much of an issue, because Python 3 isn't so different from Python 2 that it's hard to pick up the other very quickly (especially given how much has been backported to 2.7). But it's unfortunate to see people continuing to write new code in Python 2.
I assume there is a good answer for switching to Python 3, but I honestly don't know (haven't bothered to do any research though).
Harshly put: I care about getting my python script working as soon as possible and for a foreseeable future - I couldn't care less for the Python language and it's future.
This bothers/worries me, because I don't understand where this notion that "learning Python 3" requires significant effort or commitment comes from. Python 3 isn't massively different from Python 2. I learn more "new stuff" (APIs I've never used before, implementation details of systems I work on/with, etc.) basically every month than that difference.
Python 2 -> 3 can be a big step because of dependencies. The difference between the languages themselves is negligible (and yet, IMHO for the better). You don't need to learn any new ways of thinking here.
If you're comfortable with Python 2, you're comfortable with Python 3 as well. If your dep ducks are in a row and you're writing new code, it's an obvious choice.
I use Python 2 because of the massive ecosystem of libraries that have been written, work, and will continue to work.
It's shortsighted and more than a little irresponsible to shame or muscle people into switching. Code that works is valuable. Code that has been tested for a decade is valuable. What's not valuable is forcing an upgrade to a platform that nobody wants to upgrade to while forcing us to abandon third-party code with years of field testing that the authors aren't ever going to port to python 3.
It was for the OP. Can't fault me for my reply not reading on an argument you make after the fact :).
> I use Python 2 because of the massive ecosystem of libraries that have been written, work, and will continue to work.
I too like useful libraries that save me time and effort, and I agree that Python 2 is extremely strong there. I feel like Python 3 is catching up and has a pretty good library story going for it already (my gratitude to those who make that happen through their contributions), in addition to being a language I find more enjoyable and productive to use than Python 2.
> It's shortsighted and more than a little irresponsible to shame or muscle people into switching.
I don't think I've done either, and I think you're being quite rude here. I was merely voicing my opinion that the magnitude of the differences between Python 2 and 3 gets blown out of proportion. Please be mindful of the context.
> that nobody wants to upgrade to
Not so, I've wanted to and have upgraded things to Python 3, and so have others.
As for the whole "forcing" stuff - well, yes, it happens. As a user of a language you're part of a community, and communities can sometimes decide to go into a direction you don't agree with. It's frustrating and difficult, and you can reasonably decide that it's a deal-breaker and leave the community. Often however it's valuable to instead put one's efforts into achieving consensus, and then defending and carrying that consensus, even if it's not what you originally wanted - shit tends to get done faster then, to the benefit of all.
Nobody who's making anything that actually matters and delivers value to customers cares about the improvements in the language itself as much as they care about the battle-tested libraries that come with that particular language.
If you are a company that actually matters (has significant growth / users) and you use Python3 over Python2 as the main language in your stack, I'd like to know who you are, if you even exist.
Guido just created a bigger problem. No good deed goes unpunished.
This shows a serious disconnect from reality. Discontinued support for Python 2 was never a major reason to move to python 3 for apps. Library support is WAY more important in the choice to switch. If all of the libraries worked with Python 3, there would be no reason for app writers not to switch.
If only there was a way to deprecate a language, with the same meaning as deprecating an API method: "it's not gone yet, but it will be soon, so in strict mode using it is an error." (The main problem to solve would be: strict mode of what? The package manager?)
One way that usually works is to release a newer version and stop updating the old one after five years. Oh wait...
In fact there'd be "tens of thousands" websites made with Python alone (Django et al), so the number of apps in total will be much higher.
Heck, people doing scientific Python are more than 10.000, and they write more than one new apps for their research every year.
Unicode
And of course, you'll move from a platform that's shutting down to one that's evolving
Really, it's worth it.
But that's OK, because 2.7 is exactly for the people who have to maintain old 2.x projects and people who never want Python to change again (and will just move to Rust or something soon anyway, instead of learning and using features in Python 3).
If you can live with that, then by all means stick to 2.7 until your Red Hat support contract expires. If not, consider switching to 3.x.
Potentially no new libraries (for new things and/or API connections)
Not sure how long new versions of existing libraries will keep 2.7 support.
Now If I had stayed on 1.2, then many of the extra libraries I am using or looking at these days would not be compatible. (Now sometimes I want to use older libraries that have not been kept up to date, but the more popular packages which gain traction - the "more important ones" tend to keep up to date or replaced by ones that do).
A language is different from a framework, but I assume once enough traction is gained, then the same thing will happen with Python - popular packages will end up up on Python 3 only. There seems to be a fair bit of 'push' from the community for people to move to Python 3, with comments of "why not change already".
I rarely write anything high language besides small scripts. Python 2 does the job. If I ever were to need functionality of another language, great, it's fun to learn something new. Our time is limited and we must prioritize. Sadly we cannot invest time to learn everything (well I guess it's possible, but I rather be awesome in four languages than mediocre in twenty).
Just so you do know what the story is with python3: It's mostly a move to proper unicode support (which couldn't be done without breaking backwards compat) but it's a relatively minor change for most code. You'll definitely run into some library support issues, but they should be few and getting fewer. It shouldn't be terrible, and I'd encourage you to do it just for the sake of Guido and the python community, because this transition has been a bit of a burden for them.
You admit you haven't done any research, so you clearly don't have any basis for making that statement.
- "Ugh, that thing is lacking/stupid/messy."
- "Oh, no problem, that wart has been fixed in Python 3"
- "Can we use it?"
- "No."
It's a real pain in the ass when I try to publish my own, though. The generally accepted rule is that all libraries must support 2.6 through 3.4, and this can be a major hassle.
I'm not sure if it was something I did but I also occasionally found that when pip'ing Python 3 libraries with a lot of dependencies, occasionally some of them would actually be Python 2 libraries and things would break.
Your argument is right, but they should have thought about that before fracturing the python community.
The Java model of using separate lifecycles for the runtime/JVM and the language itself is probably a good role model for the future; it allows introducing new language features without any danger of creating library inconsistencies and allows specifying source and VM versions individually.
In what way is python 2 more convenient to write? Outside of the rapidly shrinking set of cases where the best approach to a key problem is addressed by a Py 2 only library -- or the case of "I want to deploy on Google App Engine" -- I don't really see how Py 2 is "more convenient".
Because python 3 was not the most stable at the time of distribution of that operating system. Why would I the developer of said operating system release anything but the most stable versions of the language? This would in turn make my operating system at times less stable.
Its not that difficult.
Arch comes with Python 3 as default.
Yes, its a function not a statement, so its now print(x).
> which also gets rid of "print x,", which printed something without making a newline, for one thing.
Sure, you have to do: print(x,end=' ')
if you want to space separate things printed on separate code lines on the same output line.
Of course, if the extra keystrokes bother you, its really not much one-time cost to toss together a library that provides a function that gets rid of them, while keeping the rest of the power of the print function:
def p(*args, **kwargs):
kwargs = {'end': ' '}.update(kwargs)
print(*args,**kwargs)
Though if I was going to bother to do that, I'd probably do it with the same separator for multiple items on the same line as for items on different lines: def p(*args, **kwargs):
kwargs = {'sep': ' ', 'end': ' '}.update(kwargs)
print(*args,**kwargs)
or, further leveraging print-is-a-function: import functools
p = functools.partial(print, sep=' ',end=' ') print(x, end='')
Not quite as nice, but not exactly unusable.This isn't disappointing, it is refreshing. Python is dead, long live Python.
But, I have to say, that during the keynote by Guido this morning, this was more-or-less the sentiment that I was left with, but with a #positivepython-twist.
Listening to Guido, I left with the inspiration to try and help this community make that migration.
I hope that, by this time next year, I can have made some contribution to the community that will help people such as the GP be in a position to use "the latest and greatest".
Here's the list, let's make it green: