realpython / python-guide

Python best practices guidebook, written for humans.
https://docs.python-guide.org
Other
28.36k stars 5.83k forks source link

Elaborate on 2.x vs 3 .x #48

Closed benregn closed 10 years ago

benregn commented 12 years ago

Would it be beneficial to elaborate on choosing between those two?

kennethreitz commented 12 years ago

Absolutely. That part of the guide is lacking at the moment.

askedrelic commented 12 years ago

http://python3porting.com/ is a good resource covering porting and differences between 2 and 3

flying-sheep commented 12 years ago

i don’t think the unreflected suggestion to use python 2 is still valid. see there for the discussion that lead me here.

@askedrelic porting is a wholly different matter. i guess this issue here is just about the phrase

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.

however, if you want to write something about porting, i’d highly recommend reading this article, which is summarizing what was discovered during porting sqlalchemy.

kennethreitz commented 12 years ago

@flying-sheep that was a funny joke :)

DanBurton commented 12 years ago

Library support for 3 is decent lately, should we really continue to point newbies at 2.7? It would be best if we could list a couple major libraries that don't have 3 ports coming anytime soon, and recommend the newbies use 3.x unless they anticipate needing one of those libraries.

Also, I don't get why it is recommended that module writers support 2.5 and 2.6, and add 3.x support later. Why not recommend that they support 3.x first, and add 2.x support as they get requests to do so?

In short, let's encourage newcomers to help adoption of 3.x.

flying-sheep commented 12 years ago

@kennethreitz excuse me?

@DanBurton exactly this. there is a reason why python 3 exists and is incompatible: to fix errors in language design.

it’s counterproductive to advise newbies to start learning the obsolete language features and continue with the fixed ones “if they must”, quite the opposite. python 3 needs more adopting developers, not less.

i’m sure Dan’s solution is the way to go.

kennethreitz commented 12 years ago

http://python3wos.appspot.com/

It'll be a good 6 months at least until we can recommend it. Likely 12–18.

flying-sheep commented 12 years ago

better do it now and link to this list imho. then anyone can make an educated decision.

btw: i’ve never heard of most of these python2-packages besides django, werkzeug, flask, zope and plone. i also think the list is misleading since many addons for the mentioned libs are listed, and pylons is superseeded by pyramid: http://pylonshq.comhttp://www.pylonsproject.org/

kennethreitz commented 12 years ago

django, werkzeug, flask, zope and plone are debatably some of the most heavily used modules around. It's a big deal.

I'm personally helping out with werkzeug and flask, and hope to have the next gen of these modules out within the next several months.

flying-sheep commented 12 years ago

cool, thanks!

but what are we gonna do now? telling the users that python3 is the future, but some important projects aren’t ported to python3 yet, which does only matter if they want to use one of them?

i am certainly not interested in most of these python2-only packages, the only exceptions being flask and django (and thus necessarily werkzeug, since flask depends on it)

mahmoudhossam commented 12 years ago

I started learning python recently, and I think python2.7 is still the way to go.

Differences between 2.7 and 3.0 aren't that significant, at least syntax-wise.

For the time being, most libraries work with 2.x, but don't with python 3, and until this changes, we should still recommend 2.7 to those new to the language.

jabagawee commented 12 years ago

With big advances since half a year ago (Django finally becoming Py3k-compatible comes to mind, Python 3.3 being released), I feel like it'd be more wise to encourage Python 3 adoption. A major reason Python 2.x remains popular is because there are so many developers working on it, and I don't think we should be encouraging more.

sigmavirus24 commented 12 years ago

People should make up their own minds. I like the idea of saying "if you need these modules or think you will ever them, use python 2.7.x, otherwise you should be safe using python 3". Then again, when I first started using python (a couple years ago), I wasn't expecting to pick up django or flask and probably would have said "well, python 3.x for me" only to be kicking myself now.

Itxaka commented 10 years ago

I think it should be written like this: "If you pretend to work in a business, learn python 2.5-2.7 as most servers are outdated and learning python 3 will get in the middle"

Seriously, In my experience, it's better to learn something established if you want to work for a third party as most servers, so I will strongly point that.

syndbg commented 10 years ago

I think this can be closed.

In which-python.rst the issue is addressed. We might just insert an extra link to https://caniusepython3.com/ so people know how they can check if packages from a requirements file can be used with python3.

flying-sheep commented 10 years ago

much more than the 18 months have passed, many projects were ported recently and not so recently (paramiko! flask! boto, …)

http://python3wos.appspot.com/ is green as a nuclear pasture.

“i strongly recommend python 2” is a recommendation the python community doesn’t need noobs to hear.