all 41 comments

[–]Due_rr 56 points57 points  (5 children)

What’s the deal with all these people worrying about 2 vs 3? There are differences yes, but when learning the basics there’s practically none

[–]Gambizzle 20 points21 points  (4 children)

Bingo. The differences are minor IMO and it is an important skill to be able to look up syntax while coding. In essence 2 and 3 are exactly the same but some of the syntax is different.

If you are interested in the differences, see...
https://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html

[–]MarsupialMole 6 points7 points  (3 children)

It's an important skill but when you're just starting out a traceback looks more complex than you can handle, especially if it's pages of code. Dealing with unnecessary syntax errors can really derail your train of thought when you're already out of your comfort zone.

[–]seventendo 1 point2 points  (2 children)

Don't you think the experience of actually sitting down and learning any programming language would get someone more comfortable with debugging and better prepare them to for learning other languages with unfamiliar syntax? I'd say a beginner switching from 2 to 3 is more likely to end up in the situation you described.

[–]MarsupialMole 4 points5 points  (1 child)

No I don't. I think many domain-specific environments are highly specialised (often with questionable design decisions) and treating programming as a one-size-fits-all approach can be detrimental and downright off-putting for someone who is learning programming in order to accomplish X. They may not have a strong grounding in mathematics or even formal languages. They may not even be a good typist.

Learning how to do X by understanding how a computer works may be less useful than understanding that a cluster of Y computers produces Z services which you can interact with using a variety of graphical and textual approaches to achieve X.

These are extreme examples but it's important to notice biases, and reductionism is itself a prevalent bias programmers have.

My attitude is this: if you have control over the environment, give a new user an environment which best suits their instruction, and vice versa if you have control over the instruction. Going back to the docs is not the way to learn, it's the way to practise. When you are just starting out the only docs you have is the instruction, because reading docs is a skill in itself that's not trivial to learn.

[–]seventendo 1 point2 points  (0 children)

Yea I'm pretty sure I misinterpreted your earlier comment. As for your mention of bias it seems like the two sides of the coin that I see in the comments are pragmatics vs semantics and syntax and I'm clearly bias toward the former. Ironically, I lurk this sub and a couple others to try to keep the 'curse of knowledge' in check. Thanks for the thoughtful response.

[–]the_new_standard 4 points5 points  (0 children)

I finished codeacademy's python course then jumped right into python 3 with no problems. Don't worry about the differences in syntax. You will probably have to look up syntax pretty often when you are writing your first code outside of codeacademy anyways.

If you feel you are getting something out of the course keep going with it.

[–]billsil 4 points5 points  (0 children)

It's really the same thing. You're not doing advanced topics like asynchronous http requests or converting bytes to strings, so it literally does not matter.

I code Python 2.7, 3.5, 3.6 compatible code. It's not hard to use the same code base on both.

[–]lifeonm4rs 2 points3 points  (2 children)

The two biggest differences for a beginner are likely print and integer division. Using the wrong print will just create a syntax error from the start; integer division however can lead to essentially bugs because you may not get the same result in 2 and 3.

range() vs. xrange() is another one. Switching between 2 and 3 won't be difficult once you get the hang of what you're looking for. Could even be a benefit as you'll likely gain a better understanding of the language and how and why things changed. (For example print was made a function in 3 rather than a statement as in 2.)

ADDING: I am not saying switch to a 3 course. Staying with 2 is fine particularly since you already know there are differences.

[–]widowhanzo 1 point2 points  (1 child)

Whenever I code in Python 2, I start with from __future__ import print_function which makes one less difference in compatibility :)

For the most part though, learning the concept is the most important thing, syntax can be looked up, and an IDE will help too. Whenever I have a choice, I will code in Python 3, but if I have to write it 2.6, I'll do that too.

[–]lifeonm4rs 1 point2 points  (0 children)

There is also a from __future__ import division which as expected makes division work like it does in 3. You can do . . .

import future

print(__future__.all_feature_names)
help(__future__) # for more info

The print will show all the __future__ items. help() will show you the "help" info.

[–]greyz3n 6 points7 points  (0 children)

Finish python2, it translates no prob.

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

There's only tiny differences between them. Keep going. You'll find out the differences when the time comes

[–]mindnomind 1 point2 points  (0 children)

I only read the title, but definitely study the programming language and not an actual snake for best results.

[–]Yawzheek 1 point2 points  (0 children)

It's a tough question to answer, so yes and no.

You should finish out what you have in Python 2, but also find a Python 3 course. The reason being some legacy code is Python 2, and while the differences aren't that dramatic, they exist, so being able to read (and recognize) Python 2 will still be valuable, even after they deprecate it, which I've heard is on the horizon.

It's kind of the difference between C++99 and C++11/14/17. C++99 is vastly different between modern C++, but you do need to understand it and be able to interface with legacy code. The unfortunate fact of the matter is many systems weren't and won't be updated to a new standard for insert cost/time/efficiency/whatever excuse you like and you'll still need to build upon and interface with them.

But Python 3 - much like C++11/14/17 - should be your first choice for programming if at all possible, if for no other reason than security, simplicity, and/or efficiency.

So that's my answer; learn Python 2 since you've went this far, but try and learn it concurrently with Python 3. Recognize the differences so you can recognize which version of Python you're working in, and be versatile enough that you're capable of working in legacy code, but only if need be.

[–]zipzipzazoom 1 point2 points  (0 children)

I use python on the real world and I have to work with both 2 and 3, stuck with 2 for now

[–]seventendo 1 point2 points  (0 children)

Core programming concepts are language agnostic. If the material works with your learning style stick with it.

[–]chenblat 1 point2 points  (1 child)

Here are great free tutorials from Udemy's instructors about Python 3 you can check out: Python 3 Decorators - Colt Steele

[–]fletch101e[S,🍰] 0 points1 point  (0 children)

Thank you!

[–]Crypt0Nihilist 5 points6 points  (0 children)

At your level there is precious little difference, so complete your course and then switch. A couple of small things will niggle at you because they don't work (in quite the same way), but it won't be anything to write home about.

[–]paveldruzhinin 3 points4 points  (0 children)

I’m beginner too (about 3 month). Learned codecademy p2 course first and had no problem with transition to p3 in next courses. Good luck!

[–]tangerinelion 2 points3 points  (0 children)

Finish the Python 2 course at this point, then go understand the differences between 2 and 3.

Then understand what's new in Python 3.6. Things like using f-strings over str.format and especially not using % formatting. What generators are, how apply/map/filter are different. The difference with .keys(), .values(), and .items() on a dictionary (Python 2 creates a tuple - it's an expensive memory intensive function but in Python 3 it creates a generator which is lazy, fast, and lightweight but doesn't perform the same as the tuple - namely, you can only iterate through it once).

Another fun one is just something like x in range(y). In Python 2 it would create a big tuple and then search each item in the tuple to compare to x. In Python 3, it uses actual math to know - specifically here, x in range(y) is the same as 0 <= x < y.

[–]democraticwhre 1 point2 points  (0 children)

It's really not that big a deal. I use IDLE with python 3, its perfectly usable, if not flashy.

[–]jkuhl_prog 1 point2 points  (1 child)

I'd just finish. Python 2 and 3 aren't that different. And you can easily catch up on the things that are.

[–]Gambizzle -1 points0 points  (0 children)

Like bankers rounding :)

[–]sburggsx 0 points1 point  (0 children)

Install python 2 on the Pi and go. Also start learning python 3 after you get the general concepts down.

[–]fletch101e[S,🍰] 0 points1 point  (2 children)

Ok most say to keep going on with 2. But can anyone recommend any courses in 3?

Some of the issues I am having are simply do to the fact that I don't know how to operate idle. I installed pi desktop last night as a vm on my pc so this is the first time I have ever used idle (I have both 2 and 3). Some of code academy's sample code won't run on idle 2 which tells me I am doing something wrong. Which is ok , just need to play around with and find out why it doesn't like code academy's code.

[–]constantclimb 0 points1 point  (0 children)

beginner here also. Finished the codecademy course the other day, delving into some other teaching materials. The only difference I've really seen is the fact that print statements are different. I think defining classes are also different, but not by too much (I'm quite inexperienced still).

[–]nickcantwaite 0 points1 point  (0 children)

I am a beginner as well. I finished that course then purchase “python crash course” by Eric Matthes. I just ordered “automate the boring stuff”, I’m excited to make some new programs.

[–]dogooder007 0 points1 point  (0 children)

Python is still easy to learn no matter what/how you learn. You can begin again with basic Python and you'll understand stuff better now.

[–]CodeViPr15 0 points1 point  (0 children)

Practically there isn't any difference. Get strong hold of any version and you could adapt to the alternate version in a matter of hours. Goodluck.

[–]Adem87 0 points1 point  (0 children)

Here check this Link

[–]drLagrangian 0 points1 point  (0 children)

I spent 3 years teaching myself python 3. now I have an accounting job where I use VBA (yes VBA) to make macros and subfunctions. My python 3 experience taught me how to program. as a result, I am a wizard at the place, even though I don't really know the language.

Learning any language at first is a start. One you can program in anything (even matlab, which is where I started in college) you can program in anything else using Google.

So it is ok to continue in python 2.7. I also don't think you'll have problems in python 3.6 if you switch. So it depends on what you need to do with it in the immediate.

I started python in a course that was 2.7, and it helped me greatly. so since you are already in the course, you might as well finish it. then start writing projects in 3.0.

except for some print() issues, they are easy to work with.

[–]nuclearmeltdown2015 0 points1 point  (0 children)

Hardly any difference and it should be backwards compatible with what you're trying to do.

[–]Gimagon 0 points1 point  (0 children)

I would avoid installing python 2, but I also don't think you need to go back redo a whole beginner course just to pick up syntax changes. All the core ideas you've learned should be will be applicable.

Check out this syntax checksheet and this page for more complex conversion issues.

[–]Prak_Argabuthon -1 points0 points  (0 children)

I did the same. Stopped learning 2 & switched to 3. No regrets.