Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Joegeddon

Python 2 vs Python 3

Recommended Posts

Posted · Original PosterOP

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 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 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 post
Share on other sites
Posted · Original PosterOP
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 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 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 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 post
Share on other sites

Python 2 is faster in a lot of use cases when compared to Python 3. Just use what you feel more comfortable, and if you want to migrate to Python 3 keeping all your code, just use 2to3.

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


How to setup MSI Afterburner OSD | How to make your AMD Radeon GPU more efficient with Radeon Chill

iPhone 8 Plus (Mid 2019 to present)

Samaritan XL (Early 2018 - present with 2019 GPU upgrades) - AMD Ryzen 7 1700X (8C/16T) , MSI X370 Gaming Pro Carbon, Corsair 16GB DDR4-3200MHz ,  Asus ROG Strix RX Vega 56 , Corsair RM850i PSU, Corsair H100i v2 CPU Cooler, Samsung 860 EVO 500GB SSD, Seagate BarraCuda 2TB HDD (2018), Seagate BarraCuda 1TB HDD (2014), NZXT S340 Elite, Corsair ML 120 Pro, Corsair ML 140 Pro

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 post
Share on other sites
Posted · Original PosterOP
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 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 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 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 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


×