1
00:00:00,000 --> 00:00:06,990
Everything in Python 3 is an object: variables, functions, even code;

2
00:00:07,000 --> 00:00:10,990
all of these things are actually objects.

3
00:00:11,000 --> 00:00:16,990
In Python every object has an ID, a type, and a value.

4
00:00:17,000 --> 00:00:21,990
The id is a unique identifier that identifies a particular instance of an object.

5
00:00:22,000 --> 00:00:25,990
This cannot change for the life of the object.

6
00:00:26,000 --> 00:00:30,990
The type identifies the class of an object, and again this cannot change for

7
00:00:31,000 --> 00:00:32,990
the life of the object.

8
00:00:33,000 --> 00:00:38,990
The value is the contents of the object, including whatever variables, or methods,

9
00:00:39,000 --> 00:00:40,990
or properties the object may have.

10
00:00:41,000 --> 00:00:46,990
Mutable objects can change their value; immutable objects cannot.

11
00:00:47,000 --> 00:00:50,990
Let's take a look in an example of an object. This is idle.

12
00:00:51,000 --> 00:00:53,990
It's the graphical interface of the Python shell.

13
00:00:54,000 --> 00:00:59,990
Python comes with this in graphical environments like Windows and Mac.

14
00:01:00,000 --> 00:01:02,990
And if you are in a non-graphical environment, an environment with just a

15
00:01:03,000 --> 00:01:06,990
command line, you can just run the Python by interpreter with the command line

16
00:01:07,000 --> 00:01:09,990
and you'll get exactly the same interface.

17
00:01:10,000 --> 00:01:11,990
So let's go ahead and create a variable.

18
00:01:12,000 --> 00:01:13,990
For example, let's create an object.

19
00:01:14,000 --> 00:01:17,990
We'll call it x, and we'll assign it the number 42.

20
00:01:18,000 --> 00:01:20,990
So we type x by itself.

21
00:01:21,000 --> 00:01:26,990
The Python shell here will give us the value of x. So that's its value.

22
00:01:27,000 --> 00:01:32,990
Its id is this number, and the size of the number, what the number looks like is

23
00:01:33,000 --> 00:01:35,990
going to be different depending on what your implementation is.

24
00:01:36,000 --> 00:01:37,990
Generally, it's like an address.

25
00:01:38,000 --> 00:01:42,990
It is a unique identifier that identifies this particular object.

26
00:01:43,000 --> 00:01:46,990
And the type of x is class int.

27
00:01:47,000 --> 00:01:51,990
And you remember everything in Python is an object, and so objects have class.

28
00:01:52,000 --> 00:01:54,990
Their type is a class.

29
00:01:55,000 --> 00:01:57,990
And so in this case it's an integer.

30
00:01:58,000 --> 00:02:03,990
All variables in Python are first- class objects, and what that means is that

31
00:02:04,000 --> 00:02:08,990
what might look like a simple variable may actually be something more complex.

32
00:02:09,000 --> 00:02:11,990
It could be an object that's been defined in a library,

33
00:02:12,000 --> 00:02:16,990
it could be a built-in object, it can be any sort of a thing, and it will

34
00:02:17,000 --> 00:02:20,990
oftentimes have attributes and methods, and we'll get into the details of

35
00:02:21,000 --> 00:02:22,990
that later on in the course.

36
00:02:23,000 --> 00:02:25,990
But for now what's important to understand is that everything in Python is an

37
00:02:26,000 --> 00:02:30,990
object, including variables, and as we look at variables and we look at the types

38
00:02:31,000 --> 00:02:35,990
of variables and how we use them, you need to realize that they are objects, and

39
00:02:36,000 --> 00:02:41,990
we'll oftentimes be using syntax like this v.attribute or v.method to access the

40
00:02:42,000 --> 00:02:52,000
attributes and the methods within those objects.

