4 ms·
Ask HN: It's 2017, should I learn Python 3 or 2?
Self taught dev here: I've become a Ruby and Ruby on Rails expert. I've become awesome at Node and Express.js, and even ES6 and React.. I decided it was time to move onto Python and Django.
I began the Coursera specialization and used Python 3 to solve the first course, but then I discovered that the rest of the courses were all using Python 2.
There aren't any Python 3 powered certifications on Coursera and since last year I read the community was on the Depression Stage [1], should I learn Python 3 or 2?
PS- Any great resources you'd recommend?
[1]: https://news.ycombinator.com/item?id=10822861
- stonemetal 10y agoLearn 3. There is no point in learning a legacy system unless you need to support a legacy project. Even then start with 3 then learn the couple of things you need to do to support the older system.
- niftich 10y agoLearn 3 but also know 2. They're not that different: the concepts and ethos is the same, the APIs have been shuffled, some lower-level details are different, and in 3 text strings and byte sequences are domain-separated. You can examine the docs [1] or source for Six, a compatibility shim. Whether or not you choose to use Six in your code -- adding another dependency -- a quick glean of the docs should familiarize you with how the two versions are different. [1] http://pythonhosted.org/six/ http://pythonhosted.org/six/
- TheAlchemist 10y agoPython 3. It's a no brainer. Python 2 support will stop soon (2020). Yes there is a huge code base out there that's in Python 2 so many companies will stick to that. But eventually, they will move on, no other choice. PS. They are quite similar actually.
- detaro 10y agoPython 3, but you'll find quite quickly that you can work with both easily and examples etc you find online are generally easily translated.
- devnonymous 10y agoLearn Python 3 and its differences from Python 2. In practice there won't be many that you'll encounter. Although you might encounter the same issues (small subset of differences) repeatedly when dealing with Python 2 modules.
- deleted 10y ago[deleted]
- svennek 10y agoThree... 2 is dying (and should be!) As for resources, you can already program, so ... Browse the manual (it is quite good), look at some pythonic* style videos* , browse the giant standard library and do some stuff with it... (the last part is key) = yes, that is a genuine keyword, that can be googled and youtubed.. * * = this is good https://www.youtube.com/watch?v=wf-BqAjZb8M https://www.youtube.com/watch?v=wf-BqAjZb8M As for "2 works as good as 3", yes, if you only care about English text. Bytes are what is on the disk, byte value 229 could be "å" (in latin1) , "ĺ" in latin2, or different things in other encodings... Only the lower 127 are "standard" (unless you are in EBCDIC on a mainframe where code 78 is "+" instead of "N").. If you know the encoding of the bytes (i.e. what language/text type are they), you can "decode" the bytes to a string type, which is unicode glyphs (not utf8, which is also a byte encoding)... When you want to get back to bytes, you just encode it again.... I don't get it, why people find it so hard...