5 ms·
So, as someone just dipping their toes into Python, what did you do regarding 2 vs 3? I have been tinkering with 2 but should I go wholly with 3? Help me befo
by jcurbo 14y ago
So, as someone just dipping their toes into Python, what did you do regarding 2 vs 3? I have been tinkering with 2 but should I go wholly with 3? Help me before I just go back to Perl 5... :)
- sp332 14y agoPython 3 was on a 5-year transition. This was to let the tools develop, give time for major libraries to be ported, etc. We are now more than halfway through, so most of the important libs work fine in Py3. And the syntax is generally nicer, so you might as well start with Py3 today.
- ovi256 14y agoAs a beginner, picking between 2 or 3 should not be one of your concerns, it's a choice that does not unlock much value either way (and it does not hurt much if you pick the 'wrong' way either). I would say start on 2.7, as most of the popular Python libraries are still Python 2.x only, and 2.7 backports some Python 3 features, so you (and your code) will be ready for 3 whenever the world switches over :)
- Anirak 14y agoAlso, why would using virtualenv make anything easier? If anything, it's slightly more of a pain. Once you learn it, it's fine, but it's certainly not something I think about on a daily basis, and it sure isn't impacting my enjoyment of the language.
- verisimilidude 14y agoUnless you need a library that's only available in 2, I'd use 3 at this point. But virtualenv takes the pain away from having to choose, since you can just create a new "environment" with 2 or 3 depending upon your needs for a project. If you're coming from the Ruby scene, think of virtualenv as Python's take on RVM.
- deleted 14y ago[deleted]
- SkyMarshal 14y agoZed Shaw originally strongly advised students in his Learn Python the Hard Way course to go with Python 2, because there's less opportunity for confusion (eg, if you start with 3 there's a good chance you'll come across libs you need that haven't been ported to it yet). However, I can't find that warning anymore in the second edition, so not sure if he's changed his mind or not.
- mappu 14y agoIt's still there[1]... Make sure you install Python 2 not Python 3. [1] http://learnpythonthehardway.org/book/ex0.html http://learnpythonthehardway.org/book/ex0.html
- kibwen 14y agoSo, as someone just dipping their toes into Python, what did you do regarding 2 vs 3? As someone who was learning Python for fun personal projects rather than serious business projects, I decided to use Python 3 wherever possible, while familiarizing myself with Python 2.7 just in case. It turns out the two versions really aren't all that different. A lot of people will still recommend starting with Python 2.7, since it really is such a small jump from there to using Py3k; I essentially did the opposite. Both approaches work. Finding tooling for Python 3 might still be a challenge (I remember having to fix one or two bugs in IPython before it would run at all), and the usefulness of these tools to a beginner is really the biggest reason why you might want to stick with 2.7 for the moment. But if you're adventurous, I do highly recommend Py3k. Especially with the upcoming 3.3 release (due later this year), I'd argue that Python 3 finally has enough new features (and enough library support) to justify using it full-time. (When will it be possible to know, beyond doubt, that Python 3 is ready for prime time? When third-party implementations like PyPy and Jython make the jump. I don't know about Jython (which just recently made it to 2.7), but PyPy's working on it as we speak.)
- gecko 14y agoLearn Python 2 first, since it's vastly more supported right now, but know that it's very easy to jump between Python 2 and Python 3, and many people do. The decision of which to use on any particular project is basically: 1. Are you doing web development? If so, use Python 2. 2. If not, do you need or want to use PyPy? If so, use Python 2. 3. If not, are the libraries you want available for Python 3? If so, use Python 3. 4. Otherwise, use Python 2.
- thebigshane 14y agoThis is discussed rather thoroughly on Python's own wiki: http://wiki.python.org/moin/Python2orPython3 http://wiki.python.org/moin/Python2orPython3 Short version: Python 2.x is the status quo, Python 3.x is the present and future of the language
- HSO 14y agoWhat's the difference between "status quo" and "present"?
- dalore 14y agoThe "status quo" is outdated.
- dstorrs 14y agoSo..."the existing state of affairs" is outdated? http://www.thefreedictionary.com/status+quo http://www.thefreedictionary.com/status+quo
- sophacles 14y agoIt almost always is. The term has a connotation of "the existing state of affairs for the majority of people". So the majority of the web is largely template driven web pages/apps, served from php or java or maybe python behind apache, with some stuff enhanced by javascript. That is the status quo. All of us here of course know that is largely going to go away (and it's actively even happeninge), replaced by javscript driven single page apps where templating happens client side, and the web server becomes a file transfer mechanism for the code and some data, a well tested way of doing rpc for the rest of the data. So yes, there are pages doing this new style web right now, but that doesn't change that the mojority of web stuff is the older style. So yeah, the current state of affairs is that the web is mostly outdated. This is necessarily true always, unless that which is being examined is stagnant.
- exDM69 14y agoLearn Python 3, it has nice new language features and some of the hairy parts of older versions have been replaced with new and consistent constructs. If you need to ship and launch a software that absolutely depends on libraries that only work with Python 2, it should be rather easy to not use the newer features and go with Python 2.