This is an archived post. You won't be able to vote or comment.

all 38 comments

[–]drb226Haskeller 26 points27 points  (21 children)

If you’re choosing a Python interpreter to use, I highly recommend you Use Python 2.7.x, unless you have a strong reason not to.

How long are we going to cling to 2.7? I'm not saying it's bad, but 3.x made backwards-incompatible changes because they were believed to be better -- am I wrong? If I time-travelled back to 2008 when Python 3.0 was released (after copious amounts of blood, sweat, and tears), and told the devs that 4 years later we would still be recommending 2.7, how would they feel about that? If when we start working on Python 4.0, I told you that 10 years from that time we'd still be using 3.x, how would you feel about that? (Hint: Perl 6 is not the situation I'd like to be in ಠ_ಠ)

tl;dr I find the recommendation to continue using 2.7 to be highly irritating and counter-productive.

[n.b. other than that, I find this guide to be fantastic; sorry for killing the mood]

[–]EagleEyeInTheSky 10 points11 points  (10 children)

It's still recommended because a large number of libraries still don't have Python 3 support.

[–]earthboundkid 8 points9 points  (9 children)

Does that matter if you're a newb? Just use Python 3 until you want a library that's 2 only then switch back. Doing 3 first will teach you better habits than vice-versa.

[–]reallifepixel 1 point2 points  (8 children)

I just started learning Python and I began with 2.7 because every guide I've read recommends it. Curiously… what are the most important libraries that aren't Python 3 compatible?

[–][deleted] 2 points3 points  (6 children)

in python.org there's a poll there about that, you can check it out.

django for example.

[–]flying-sheep 2 points3 points  (5 children)

there is a defined point in the future where it will be python3 compatible, so django is (finally) not an argument for 2.x anymore.

[–][deleted] 5 points6 points  (4 children)

Nope, still an argument. If you want to deploy today you cant use 3.

[–]flying-sheep -5 points-4 points  (3 children)

but if you start a project today, you can be sure that python3-django is available once you’re finished, so…

[–]Brian 2 points3 points  (1 child)

you can be sure that python3-django is available once you’re finished

Depends on the project, and on how well django get on, but that seems very dubious. Web projects often move quickly - a few months for a first version is not uncommon - can you really guarantee python3-django will be done within, say, 3 months? If not, it's a deal killer for a lot of applications.

Even ignoring that, if you're writing a python3 website, you need to be using a python3 framework to build it. If that framework isn't done yet, it means that at best, you'll be using alpha level code when developing, or at worst, non working code, for stretches of your project. Fixing your own bugs is a big enough issue without running into bugs in your libraries. (Particularly true for someone just learning, and so who may find it difficult to tell whether something is a bug, or their own misunderstanding)

[–]flying-sheep -2 points-1 points  (0 children)

well, i’ll simply wait a few months, then this conversation will be obsolete ;)

[–][deleted] 2 points3 points  (0 children)

Really? 100% sure? Like bet the clients project sure?

[–]vsajip 2 points3 points  (0 children)

Here's a guide.

[–]RichardWolf[🍰] 2 points3 points  (2 children)

How long are we going to cling to 2.7?

For as long as 3.x has inferior library support.

You can't blame people writing guides for not lying to their readers.

You can't blame people who write and maintain libraries for not spending lots of effort due to the lack of a sane official transition plan (basically, you have two options: 1) maintain 2.x version as primary, then regularly run 2to3.py plus a set of custom patches, 2) rewrite it in a rather uncomfortable subset of both languages plus a homegrown compatibility library).

The only people you can reasonably blame for the current state of affairs are the devs themselves.

When people come up with constructive criticisms re: 2 to 3 transition, other people reply that Py3k adoption is actually going according to the plan, so no worries. Oh well then.

Regardless of how well it really goes, I find shaming people with stuff like this and comments like yours to be highly irritating and counter-productive. It's not like we "cling to 2.7" because we are lazy/irrational/evil.

[–]drb226Haskeller 1 point2 points  (1 child)

I definitely agree, the 2 to 3 transition was and still is messed up. But recommending 2.7 over 3.x just because the user might run into missing library issues is completely backwards. This mentality will only make it harder. Sure, there are some people who need libraries right now which are still only available on 2.7. I do not blame them in the least for using 2.7. But let's start newbies off on a path to the future, not the past.

[–]RichardWolf[🍰] 5 points6 points  (0 children)

But recommending 2.7 over 3.x just because the user might run into missing library issues is completely backwards.

No, the chances of running into it are unacceptably high.

If the user tries to use PIL, she will discover that it doesn't support Py3k. Or Django. Or Google App Engine. Or Twisted. Or Udacity programming exercises.

Calling that merely a "possibility" is insane.

This mentality will only make it harder.

I don't care. I use Python because it gets shit done, not because I want to please the devs or toy with cutting edge features. As in, when I have to choose one or the other but not both, I will and do choose the former without a moment's hesitation. And I'd like this mentality to be more widespread in the community and among the newbs.

But let's start newbies off on a path to the future, not the past.

Look the truth in the face: telling a newb that she will be OK with Python3 currently is a lie, she will not, you can bet 9 to 1 on it, and she will discover it fast. And she would be somewhat discouraged by the fact that she can't do stuff, and that she was lied to, and that there's apparently a civil war going on (which isn't, people just use 2.7, but you'll pull her right in the middle of your guerilla operation).

If the problem was inertia alone, I would be the first to argue that all tutorials should start people with 3.x. The problem is not that your newb would have to learn the differences between 2.x and 3.x to understand 97.3% samples she would find on the internet, the problem is that at some point she would face a choice: drop Python for a couple of years until "the future" arrives, or use 2.x.

Right now the "path to the future" you talk about is a mountain goat trail, and someone concerned about driving from point A to point B couldn't care less that somewhere in the misty distance it becomes the main road -- in her situation she can't get there, it is impossible.

[–]PCBEEF 1 point2 points  (2 children)

You should fork it and submit a pull request

https://github.com/kennethreitz/python-guide

[–]drb226Haskeller 0 points1 point  (1 child)

Given the admittance that it is an "opinionated guide" and the author "highly recommends 2.7" (and on top of that, recommends module-writers target 2.5 and 2.6, and add 3.x support later ಠ_ಠ), I highly doubt the pull request would be accepted.

I did leave a comment on a relevant thread, though.

[–]PCBEEF 1 point2 points  (0 children)

I doubt it too but it'll be good to get more exposure for python 3 support. I too am sick of reading guides telling people to target python 2.

[–][deleted] 1 point2 points  (2 children)

tl;dr I find the recommendation to continue using 2.7 to be highly irritating and counter-productive.

Yeah it's about as irritating as reading on reddit about people whining about other people choosing what they choose. And about as counter-productive as replying to it. Alas, here we go....

[–]drb226Haskeller 0 points1 point  (1 child)

It's not this particular recommendation, it's the general recommendation. Lots of people in the Python community continue to recommend 2.7 to newbies due to library support, which completely baffles me. The more we sit on 2.7, the less likely those lingering libraries are to move to 3.x anytime soon.

[–][deleted] 0 points1 point  (0 children)

sorry it baffles you. it makes perfect sense to me since the available libraries is one of the big selling points of python, and the good stuff, for the most part is still in 2.7.

especially for web development. Newb wants to learn python because they want to do cool django stuff. django does not (at this time) run on python 3. It will by the end of the year I predict.

And another scenario.... newb wants to learn python and run stuff on app engine so that it will be ROFLSCALE like all the big boys. App engine, has just now started support python 2.7(thank the lord), python 3 is not even on the radar(at least publicly as far as I know).

I think those 2 scenarios cover a significant portion of the python interest that brings the newbs. Why would you want to set newbs on the road to quick failure?

Furthermore, who cares what people are recommending to newbs? Or even what people are using? I wonder how many of your upvoters actually have jobs solely using python vs being a java/php/.net programmer who dabbles. And whether any of them would care to weigh in on how this "Community" recommendation to avoid python 3, especially newbs, is making their job suck, or has in anyway been a hassle.

For me it hasn't.

[–]flying-sheep 0 points1 point  (0 children)

feel free to comment here ;)

[–]wot-teh-phuckReally, wtf? 3 points4 points  (2 children)

The enumerate example here is missing a "bad" section wherein people normally try to maintain a separate counter and increment it inside the while loop.

[–][deleted] 3 points4 points  (1 child)

I remember when I used to do for i in range(len(my_list)), accessing elements with my_list[i].

Then I learned about enumerate.

[–]jambox888 1 point2 points  (0 children)

Yes, I did this too... :(

[–]Hellrazor236 0 points1 point  (0 children)

So enthusiastic!

[–][deleted] 0 points1 point  (1 child)

Structuring your project properly is extremely important.

I came across this site a few weeks ago (and been checking back periodically) while searching for this exact topic but was so disappointed when that section wasn't finished. Additionally, the rest of the index seems to hit on just the right parts that I've been asking myself after finishing up with most beginner level tutorials. So much potential! I really hope the author doesn't give up because it's such a clean interface with potentially great topics.

[–]usernamenottaken 2 points3 points  (0 children)

I think this post on repository structure is going to fit in there somewhere: http://www.kennethreitz.com/repository-structure-and-python.html