Jump to content

Python 2 vs Python 3

Joegeddon

I was wondering which version would be the best to learn. I took a computing science course at a National 5 level (GCSE equivalent) and in the class I learned how to use Python 2.7. I just wanted to know what are the differences between Python 2 and 3 and should I switch to Python 3?

 
  • AMD Athlon X4 760K CPU   |   MSI FM2+ ATX A88X-G45 Motherboard   |   8GB 1600MHz RAM   |   MSI GTX 760 GPU (Reference)
  • Thermaltake Versa H22 Case   |   1TB Seagate, 0.5TB Hitachi (7200RPM)   |   ArcticRed+ 700WStock    |   Windows 8.1

 

Link to comment
Share on other sites

Link to post
Share on other sites

honestly, coming from a python 2 fanboy.. its been long enough, its time to let  python 2 go and look towards python 3.

Link to comment
Share on other sites

Link to post
Share on other sites

The only difference I've noticed when following python 2 tutorials and making them in python 3 is having to change the syntax of a print statement. I know there must be more but I'm doing it at a level, just after GCSE and I haven't found anything else yet so for your level it should be fine.

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, manikyath said:

honestly, coming from a python 2 fanboy.. its been long enough, its time to let  python 2 go and look towards python 3.

What are the differences? Is it just changes in how certain tasks are written in code?

 
  • AMD Athlon X4 760K CPU   |   MSI FM2+ ATX A88X-G45 Motherboard   |   8GB 1600MHz RAM   |   MSI GTX 760 GPU (Reference)
  • Thermaltake Versa H22 Case   |   1TB Seagate, 0.5TB Hitachi (7200RPM)   |   ArcticRed+ 700WStock    |   Windows 8.1

 

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, Joegeddon said:

I was wondering which version would be the best to learn. I took a computing science course at a National 5 level (GCSE equivalent) and in the class I learned how to use Python 2.7. I just wanted to know what are the differences between Python 2 and 3 and should I switch to Python 3?

I believe Python 3 has more features compared to Python 2.

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Joegeddon said:

What are the differences? Is it just changes in how certain tasks are written in code?

they actually have an article on that:

https://wiki.python.org/moin/Python2orPython3

 

the article is a bit old by now, as actually most linux distros have moved to 3 by default.

 

if i have to name one thing that i really need to adapt to in 3 is that you need to use str() and int() casts, but thats something i can live with :P

2 minutes ago, mattonfire said:

I believe Python 3 has more features compared to Python 2.

not really so, its basicly just a "lets just screw backwards compatibility and make this mess at least somewhat optimized"

 

last time someone "benchmarked" programming languages python 2 was several times slower to execute than the resource hog that is java.

Link to comment
Share on other sites

Link to post
Share on other sites

I learned Python2 first and there are things about Python3 which annoyed me when I was switching over but I'd recommend learning Python3 if you're just starting out. Unless you know that the libraries you will be working with will only have a Python2 version.

 

As for any differences, it's mainly just slightly different syntax.

Example Python2 the brackets for printing stuff are optional while Python3 requires them.

Link to comment
Share on other sites

Link to post
Share on other sites

On ‎6‎/‎3‎/‎2016 at 6:31 AM, Joegeddon said:

I was wondering which version would be the best to learn. I took a computing science course at a National 5 level (GCSE equivalent) and in the class I learned how to use Python 2.7. I just wanted to know what are the differences between Python 2 and 3 and should I switch to Python 3?

Python 3.

 

It's more modern and will actually still be used in like 5 years. Can't say the same about 2.x

Judge a product on its own merits AND the company that made it.

How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill | (Probably) Why LMG Merch shipping to the EU is expensive

Oneplus 6 (Early 2023 to present) | HP Envy 15" x360 R7 5700U (Mid 2021 to present) | Steam Deck (Late 2022 to present)

 

Mid 2023 AlTech Desktop Refresh - AMD R7 5800X (Mid 2023), XFX Radeon RX 6700XT MBA (Mid 2021), MSI X370 Gaming Pro Carbon (Early 2018), 32GB DDR4-3200 (16GB x2) (Mid 2022

Noctua NH-D15 (Early 2021), Corsair MP510 1.92TB NVMe SSD (Mid 2020), beQuiet Pure Wings 2 140mm x2 & 120mm x1 (Mid 2023),

Link to comment
Share on other sites

Link to post
Share on other sites

On 02/06/2016 at 11:31 PM, Joegeddon said:

I was wondering which version would be the best to learn.

One should always start with the most recent technology (within reason). Your instincts should be telling you that much at least.

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

8 hours ago, Nuluvius said:

One should always start with the most recent technology (within reason). Your instincts should be telling you that much at least.

Everything I've learned so far has been in Python 2.7. It's only a high school computing science course though.

 
  • AMD Athlon X4 760K CPU   |   MSI FM2+ ATX A88X-G45 Motherboard   |   8GB 1600MHz RAM   |   MSI GTX 760 GPU (Reference)
  • Thermaltake Versa H22 Case   |   1TB Seagate, 0.5TB Hitachi (7200RPM)   |   ArcticRed+ 700WStock    |   Windows 8.1

 

Link to comment
Share on other sites

Link to post
Share on other sites

14 minutes ago, Joegeddon said:

It's only a high school computing science course though.

What do you mean by that exactly?

The single biggest problem in communication is the illusion that it has taken place.

Link to comment
Share on other sites

Link to post
Share on other sites

5 hours ago, Joegeddon said:

Everything I've learned so far has been in Python 2.7. It's only a high school computing science course though.

Dont worry, the syntax is almost the same, apart from the print statement/function. But you do get more features (iirc 2.7 is the last python 2), guaranteed working on most systems that arent windows (linux and OSX come with python 3.4), and (not sure if my memory serves me right on this) faster exectution.

"Unofficially Official" Leading Scientific Research and Development Officer of the Official Star Citizen LTT Conglomerate | Reaper Squad, Idris Captain | 1x Aurora LN


Game developer, AI researcher, Developing the UOLTT mobile apps


G SIX [My Mac Pro G5 CaseMod Thread]

Link to comment
Share on other sites

Link to post
Share on other sites

On 3 June 2016 at 8:31 AM, Joegeddon said:

I was wondering which version would be the best to learn. I took a computing science course at a National 5 level (GCSE equivalent) and in the class I learned how to use Python 2.7. I just wanted to know what are the differences between Python 2 and 3 and should I switch to Python 3?

Python 3 is the better one to learn, it's more similar to bigger languages like C++ with slightly stricter syntax.

1474409643.6492558

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×