1
00:00:00,950 --> 00:00:04,080
Hey, in this video, we will talk about Python versions.

2
00:00:04,100 --> 00:00:12,170
You will understand what a Python version is and why it is important to know about Python versions.

3
00:00:12,170 --> 00:00:21,410
So let's begin let's talk about some history first, Python version 1.0.0 or simply Python one was released

4
00:00:21,410 --> 00:00:27,230
in 1994 and six years after that, Python two was released.

5
00:00:28,310 --> 00:00:29,600
In 2000.

6
00:00:30,940 --> 00:00:38,680
Eight years later, point three was released and currently Python three is the current version now.

7
00:00:38,710 --> 00:00:47,410
These were major releases, 1 to 3, but there are also minor releases and patch releases as well,

8
00:00:47,410 --> 00:00:48,730
which I'll talk about now.

9
00:00:49,660 --> 00:00:56,530
So when you download a python interpreter from Python dot org, you download something like Python 3.8

10
00:00:56,530 --> 00:01:03,490
11.2 or python three point 12.7 or python three point 10.8 etc..

11
00:01:04,879 --> 00:01:06,590
Now the last number.

12
00:01:08,500 --> 00:01:10,150
Is the patch release.

13
00:01:11,140 --> 00:01:14,380
So this is a release of a new Python version.

14
00:01:14,740 --> 00:01:22,910
For example, when we switch from three point 11.1 to 3.11 point two.

15
00:01:22,930 --> 00:01:28,200
So the Python developer team releases Python three point 11.2.

16
00:01:28,210 --> 00:01:36,280
And in that release, what happens is that there are bug fixes and other small changes in that particular

17
00:01:36,280 --> 00:01:37,270
release.

18
00:01:38,470 --> 00:01:42,790
Now this release is backwards compatible, which I'll talk about in just a bit.

19
00:01:45,040 --> 00:01:47,070
Then we have the minor releases.

20
00:01:47,080 --> 00:01:49,330
Now these are bigger features.

21
00:01:49,330 --> 00:01:56,680
So it's about, for example, switching from Python 3.10 to Python 3.11.

22
00:01:57,750 --> 00:02:04,410
So the second number indicates bigger features in the newer version that is released.

23
00:02:04,560 --> 00:02:07,140
And this is also backward compatible.

24
00:02:07,170 --> 00:02:13,620
Now, when we have a major release, for example, when we when we go from Python two to Python three.

25
00:02:15,830 --> 00:02:23,150
There are many big features that were released and the code is not backwards compatible.

26
00:02:24,990 --> 00:02:27,250
Now, what does backwards compatible mean?

27
00:02:27,270 --> 00:02:29,400
This is what I'll explain right now.

28
00:02:29,400 --> 00:02:32,430
So let's look at an example for that.

29
00:02:34,750 --> 00:02:35,470
Here.

30
00:02:35,470 --> 00:02:45,970
And this winter here I've started a Python 2.7 interactive shell, so I'm using the interpreter of Python

31
00:02:46,000 --> 00:02:49,090
2.7, which was released many years ago.

32
00:02:49,180 --> 00:02:53,530
And down here I've started a Python 3.10.

33
00:02:54,830 --> 00:02:55,910
Interactive shell.

34
00:02:55,910 --> 00:03:05,870
So I'm using the Python 3.10 interpreter down here now in Python 2.7 to print a string we could use

35
00:03:05,870 --> 00:03:06,830
print.

36
00:03:07,580 --> 00:03:08,320
Hello.

37
00:03:08,330 --> 00:03:12,500
Just like you see, it's here without the parentheses and you get the hello string.

38
00:03:12,530 --> 00:03:22,010
Ah, but in Python 3.10 if you do print hello like that, you'll get an error.

39
00:03:22,280 --> 00:03:24,860
So that means python 3.10.

40
00:03:25,640 --> 00:03:35,270
Or to be more exact, Python three is not backwards compatible because what's exactly a release?

41
00:03:35,630 --> 00:03:41,630
A release, For example, when Python three was released, what happens is that two things.

42
00:03:41,900 --> 00:03:49,910
First is that an interpreter program is created and you can download that, but also the documentation

43
00:03:49,910 --> 00:03:55,070
of the language changes to fit this new interpreter.

44
00:03:55,070 --> 00:04:02,720
So the new interpreter expects this kind of code print with parentheses.

45
00:04:02,900 --> 00:04:03,920
So like that.

46
00:04:06,220 --> 00:04:10,480
So the new interpreter for Python three expects that.

47
00:04:11,320 --> 00:04:15,460
Code and in the documentation you'll also see this code documented.

48
00:04:16,300 --> 00:04:26,410
And so this new version of Python Python three ignores the code that was available in Python two.

49
00:04:26,440 --> 00:04:30,580
Now, practically for programmers, what does it mean practically?

50
00:04:30,610 --> 00:04:38,170
Well, let's suppose that you have written a web application and the code is something like this.

51
00:04:38,200 --> 00:04:40,030
Let's suppose this is a code.

52
00:04:40,030 --> 00:04:42,610
So you have written it in Python two.

53
00:04:44,550 --> 00:04:48,000
And this code is now running on a server computer.

54
00:04:48,000 --> 00:04:51,810
And this code produces your website, your web application.

55
00:04:52,650 --> 00:04:55,530
But now Python three is released.

56
00:04:56,180 --> 00:04:57,800
So you have two choices.

57
00:04:58,250 --> 00:05:07,250
Either you ignore Python three and you keep running this code using your Python 2.7 interpreter or 2.6

58
00:05:07,250 --> 00:05:07,920
or whatever.

59
00:05:07,940 --> 00:05:12,070
So python two and your app will keep running just fine.

60
00:05:12,080 --> 00:05:12,620
Right?

61
00:05:13,220 --> 00:05:15,560
So you can ignore python three.

62
00:05:15,830 --> 00:05:22,010
Or the other option is that you go to your code and you make the necessary changes.

63
00:05:22,010 --> 00:05:30,200
So you add parentheses here in this Hello string and here row inputs you change it to input because

64
00:05:30,200 --> 00:05:36,110
in Python three row input is not used anymore, so input is used instead.

65
00:05:36,950 --> 00:05:43,820
And so once you make this changes, then in the server you instruct your server to run your code using

66
00:05:43,820 --> 00:05:46,760
part from three The Python three interpreter.

67
00:05:47,420 --> 00:05:53,690
In that case, you can say that you have upgraded from Python two to Python three.

68
00:05:53,840 --> 00:06:00,470
So after doing these two things, changing the code to fit Python three syntax and also changing the

69
00:06:00,470 --> 00:06:05,450
Python interpreter to to run this code using the Python three interpreter.

70
00:06:09,410 --> 00:06:10,850
Now, this could be a hustle.

71
00:06:10,850 --> 00:06:18,260
So many programmers could just leave the code base to run on Python two and they don't change the code.

72
00:06:18,260 --> 00:06:24,320
But after many years, Python two will not be supported anymore.

73
00:06:24,740 --> 00:06:27,920
So there might be security issues with Python two.

74
00:06:28,220 --> 00:06:35,300
And in that case, as a developer, you have to go to your code base and change the code base to Python

75
00:06:35,300 --> 00:06:35,900
three.

76
00:06:37,070 --> 00:06:46,010
So that you benefit from this minor releases of Python like the minor release here and the patch, which

77
00:06:46,010 --> 00:06:50,870
will happen in the current major version of Python.

78
00:06:50,870 --> 00:06:57,740
But in the previous major version such as Python four one or two, these changes will stop.

79
00:06:59,150 --> 00:07:00,200
After some time.

80
00:07:00,200 --> 00:07:06,950
So the developers of the Python team will not be working any more on Python two.

81
00:07:08,270 --> 00:07:11,220
So that's what you should know about Python versions.

82
00:07:11,240 --> 00:07:19,700
Now, as a learner, it doesn't really matter if you're using Python 3.10 or Python 3.12.

83
00:07:20,800 --> 00:07:23,410
The changes are very, very small.

84
00:07:24,070 --> 00:07:33,190
And so the code you wrote using Python 3.10 in mind will work even if you run it with Python 3.12 for

85
00:07:33,190 --> 00:07:37,930
later on because you are still in the same major version.

86
00:07:39,350 --> 00:07:47,060
Only if Python four is released later on, then you might want to think about upgrading your code to

87
00:07:47,060 --> 00:07:47,910
Python four.

88
00:07:47,930 --> 00:07:52,820
As I explained when I did the comparison between Python two and three.

89
00:07:52,970 --> 00:07:53,930
Yeah, that's.

90
00:07:53,930 --> 00:07:55,310
Thanks and see you later.

