Hacker News new | ask | show | jobs
by chimeracoder 4445 days ago
This is really disappointing to see - I fear that it will slow adoption of Python 3 even further, when it was just reaching a tipping point[0].

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.

[0] http://python3wos.appspot.com/

7 comments

On the other hand, if you are comfortable with Python 2, it will do the job, and you know it will be supported for a foreseeable future, why bother learning Python 3?

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.

> On the other hand, if you are comfortable with Python 2, it will do the job, and you know it will be supported for a foreseeable future, why bother learning Python 3?

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.

It's not about the language. Languages are easy to learn. I can learn one between breakfast and lunch and be productive by dinnertime.

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's not about the language.

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.

I didn't mean to be rude. I'm sorry if it sounded that way. I think it's both shortsighted and irresponsible to force people to abandon libraries that work.

The parent poster wasn't concerned about learning the language. They were concerned about dependencies that work, which is what I was saying:

"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."

Yes, I didn't mean "nobody" literally. I should have said "few."

> The parent poster wasn't concerned about learning the language. They were concerned about dependencies that work

No, read more of the thread - to quote the OP:

> I rarely write anything high language besides small scripts.

OK, so you could argue that their scripts probably remain small because they call into tons of third-party code, but honestly I get the impression that it's a case of working with the included batteries and not being overly concerned with dependencies. If it was solely about deps availability, they probably wouldn't have talked about "learning Python 3" as their sticking point.

^ This is the best comment in the entire thread.

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.

I'm a build engineer at Intel (100,000+ employees), and we strictly use Python3. You act like it's a completely different language. It hurts the community when you blow the situation out of proportion. There are innumerable Python3 libraries, and while there are most certainly more in the Python2 camp, who cares? This isn't a dick-measuring contest; it's a change for the better in a language we all seem to like.
Is Python the main language you guys use, over Java/C++ as well? And what's the context of its usage? How do you deal with stuff that's missing, do you just have your own employees fork and port existing libraries?

I'm not asking as a challenge to you, I'm genuinely curious.

Well, the one big reason was that you were going to lose support for Python 2. Guido just took that reason away and now tens of thousands of new Python apps are going to be written in Python 2 because they've got another 6 years to worry about it.

Guido just created a bigger problem. No good deed goes unpunished.

> Well, the one big reason was that you were going to lose support for Python 2. Guido just took that reason away and now tens of thousands of new Python apps are going to be written in Python 2 because they've got another 6 years to worry about it.

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.

Yeah but I understand GP's sentiment. As someone who writes python for my living currently, I'm a little disappointed at this because it's hard to imagine that it doesn't move further into the future the day on which we will switch our code base. I don't need to be a 3-second attention span novelty junkie to just get some pleasure out of using the latest version of the language at my workplace.
It feels like the problem is the black-and-white thinking on the part of developers of every language being either "okay to develop in" or "completely unsupported."

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?)

"If only there was a way to deprecate a language, with the same meaning as deprecating an API method"

One way that usually works is to release a newer version and stop updating the old one after five years. Oh wait...

It's the "using it in strict mode is an error" part that's important. Compilers can automatically refuse to compile deprecated-but-not-broken code. What can automatically refuse to let you start a new project in a deprecated-but-not-broken language?
Where exactly do you get this "tens of thousands" number from?
From the number of Python programmers out there and the percentage using Python 2.

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.

Oh, I see. Some people here misinterpreted what I wrote to suggest that Python isn't widely used. Clearly that's not what I meant.

I just dislike how melling basically pulled a number out of his ass, and then used it as "evidence" to back up his claims. I wouldn't even consider it a low-quality estimate, since he doesn't even try to justify or explain how that number was obtained.

In this case, "tens of thousands" could very well really be "hundreds of thousands". It could be significantly less, too. Regardless, it's purely speculative. Using such made up numbers makes his argument weaker than perhaps not using any such value at all.

No, I picked what I thought would be a lower bound. Do you think it will only be a few hundred or few thousand over 6 years? Python is an extremely popular language.
" why bother learning Python 3?"

Unicode

And of course, you'll move from a platform that's shutting down to one that's evolving

Really, it's worth it.

Python 3 really is a superior language. It took all of the good parts from 2, and left the cruft behind. The downside is that there were so many good parts of 2, and so little cruft, that 3 isn't all that much different. However, it's different enough to break things.
Not to mention `yield from`, which is awesome. Iterators everywhere is a powerful tool.
Unicode works perfectly fine on 2.x.
The 2.x API is incredibly and almost unusably confusing to someone who hasn't already puzzled out the right ways to use it from the many wrong ways that are easier to find.

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).

It's hardly shutting down if the support will last another 6 years ...
Well, if you were and are staying on Python 2.7, you are committing to anywhere from 6 (if you start now) to 10 (if you started day of 2.7.0 release) years of a frozen, non-evolving language. No new features, no improvements, nothing -- just the same language, for a decade.

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.

    No new features, no improvements, nothing -- just the same language, for a decade.
Am I alone in being excited by this? I am figuratively drooling over such stability.
No you are not alone. But you are minority. Majority sees the language not as a tool to solve specific problems, but as a goal, i.e. a way to chase its own tail endlessly. Hence the rudderless pursuit of new. The whole industry is in ADD mode - they moment they create something useful, they discard it and start a new quest.
Try ANSI C then!
If you prefer to work with a platform that will get only bugfixes/security updates go ahead

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.

No new libraries? I wonder if 2014's new Python implementation from Guido's employer Dropbox- Pyston, count as significant in your mind?

If you prefer to have no Google App Engine, Azure, Amazon or distro support other than Arch, then have at it. I'll keep that and PyPy, Pyston, Jython, IronPython, PyInstaller, not to mention all programs where Python is integrated like GIMP, all of this is Python2 only.

Enjoy your Python3. I'll stick with Python.

If you're going to build up a large code base, you don't want to have to port it when the libraries you need stop supporting Python 2.
I could have taken that attitude with Django 3 years ago, but they released a new version a week or so after I started using it. That was a simple upgrade, no problems (1.2 - 1.3). I try to stay up to date now, as it keeps many things relevant. Sometimes it causes a bit of hassle.

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".

Python 3 will do the job, what is your argument against it?
That's not a valid reason to avoid making the switch. A big backlog of code that you can't afford to port is valid; it's a business issue. But you? This is a tool of your trade, just do the research.
"Tool of your trade": I have no use of python 3, nor do I have any use for Scala, Perl, or whatever. These could all be considered "tools of my trade".

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).

It will take you an hour at most to read up on all the significant changes in Python 3. Its not like learning Scala or Perl at all. It just cuts some things that have been depreciated for years, makes everything more consistently iterable, adds some nice new comprehensions and literals, modifies certain bits of metaprogramming, and a few other smaller changes. The hardest thing for me was remembering that print is a function in 3, and needs parens.
@a1a I apologize, I was a jerk yesterday. I definitely dropped my forum manners. Not ok!

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.

> I have no use of python 3

You admit you haven't done any research, so you clearly don't have any basis for making that statement.

Nor have I done research on Perl, Scala, etc. Your missing my point. I am successfully getting my things done in Python 2. I do not have any use for Python 3, Perl, Scala, or any other language. I might have in the future, and hey, some language might be better suited to solve the problem - but as long as it's not drastically better the sensible tradeoff is to stick with Python 2.
That philosophy sounds like one that will cause you to wake up one day and realize your skill set is massively out if date.

Python 3, scala, and pearl all give you new ways of solving a problem. You're missing out on a lot of super cool stuff by not exploring! Outside of maybe library support, I see no reason to not to at least check out python 3.

I'll let you in on a secret: Python 3 is Python, just with a couple of improvements. Painting it as an entirely new language like Perl or Scala reminds me of people I used to support who thought their entire computer was different if I gave them a monitor with a different-colored rim. You're making a mountain out of a molehill.
So much for having a big toolbox with lots of different hammers available to you.
I chose to learn Ruby in part because of the confusing Python 2/3 issue. I recognize that this is a largely stupid reason to choose a language, but when lots of people suggest that either language is great to pick-up, well, it was another easy reason to lean Ruby over Python.
I don't agree at all that it's stupid (and I'm someone who'd generally pick Python over Ruby). Fragmentation sucks. Really bad fragmentation sucks more. Python's fragmentation is pretty bad.
It's funny reading this from the Zen of Python "There should be one-- and preferably only one --obvious way to do it." [1] while seeing that there are nearly two independent language/ecosystems with the name Python (namely version 2/3).

[1] http://legacy.python.org/dev/peps/pep-0020/

Having a split like that in a language is terrible. You find libraries that work with not-your-version and you envy features that would make your code cleaner/faster/better, but you can't use them.

- "Ugh, that thing is lacking/stupid/messy."

- "Oh, no problem, that wart has been fixed in Python 3"

- "Can we use it?"

- "No."

As a Python developer, usually this isn't a major problem for me when going out and finding libraries. Almost every library you find will support 2.7, so I pretty much stick to 2.7 when using or writing any code. I miss some of Python 3's good features but the library ecosystem is more important to me.

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.

But you can use Python 3, it is your business if you decide you don't want to.
Not stupid at all. The same concerns and some bad experiences with 2/3 conflicts and deployment issues drove me to Go after investing quite a bit of time with Python, and I've not regretted it yet.

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.

Hear, hear.
I think it's a strong signal to industrial users that Python is a stable and mature language whose core developers care about practical usage. Pushing Python 3 for ideological reasons ("it's the right thing to do") would alienate a lot of users who have real work to do and cannot invest weeks to upgrade to a version that does not provide them any benefits.
If the Python core developers care so much about practical usage they should never have released python3 with features that break backwards compatibility.

Your argument is right, but they should have thought about that before fracturing the python community.

Yes; I suppose they will be more careful in the future.

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.

Personally I feel more at ease going to Py3 without a knife in my neck due to short EOL
Well honestly, python 2* is a lot more convenient to write in a lot of ways, and the benefits of 3 aren't big enough to make up for it for a lot of people/use cases.
> Well honestly, python 2* is a lot more convenient to write in a lot of ways

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".

On both OSX and many Linux distros, Py 2 comes pre-installed but Py 3 does not. If I'm going to write simple scripts that I'm going to give out to people, it's nice not having to worry about them needing to fuck around to get the script to run.
> On both OSX and many Linux distros, Py 2 comes pre-installed but Py 3 does not.

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.

I totally agree. However, until Py3 is packaged standard it's always going to be easier to run Py2 code. For example, I have a friend who does data analysis on OSX and occasionally she gets data in a format that is ugly. I take a look at it and send her a python script that will massage it into something nice.

She's ok with the occasional "sudo pip install ..." to get a library, but if my instructions started with "ok, first install Xcode and then install homebrew" the answer would probably be "it's ok I'll just do it by hand"

Simple script like that are unlikely to be much different between Python 2 and 3 unless you are using specific libraries. Just make make all the "prints" into "prints()" and "Exeption, e" into "Exception as e", and I can't see what the differences would be.
It already is in many distros.
sudo apt-get install python3. Or Whatever the OSX equivalent is.

Its not that difficult.

Arch comes with Python 3 as default.

OSX doesn't come with a package manager.
can't use print x anymore, which also gets rid of "print x,", which printed something without making a newline, for one thing.
> can't use print x anymore

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.

https://docs.python.org/3.1/library/functions.html#print

It's a lot less "pythonic".
Dunno. The 3 way is more "Explicit is better than implicit." Though it's a shame Python 3 messes up http://xkcd.com/353/
I have to continue to beat the drum of gradual upgrades, Py3 features should and now will be slipstreamed into 2.N, this is a good thing.

https://pythonhosted.org/six/

This isn't disappointing, it is refreshing. Python is dead, long live Python.

Isn't this HACKER news, just hack something popular in python 3. all we need it anything written from scratch to be written in python 3.
I realize you are probably getting down voted because of the way that you wrote what you wrote.

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:

https://python3wos.appspot.com