background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "Практика программирования на Python 3, лекция №7"

input logo icon
Video tags
|

Video tags

мфти
фопф
информатика
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:02
program that we are following will succeed,
00:00:06
we have to work a lot, I
00:00:08
have to work quite a lot so
00:00:13
that the content that appears
00:00:15
right now, yes, in the process of
00:00:18
every week, the teachers
00:00:20
think something, I’m there, think through the lectures, that’s
00:00:23
not it what we have prepared for someone’s textbook is a
00:00:25
miracle we’re reading, let’s say this is what they
00:00:28
call creating a good training
00:00:29
course for them so that other physical and technical schools
00:00:32
will want other tracks too, so
00:00:37
maybe one of you will grow up in
00:00:40
two years, become a mentor at the
00:00:44
computer science department, an assistant teacher
00:00:46
in four years how to finish
00:00:48
your bachelor's degree, maybe you can
00:00:50
even become a teacher, it will be
00:00:52
very cool because personnel is very
00:00:55
needed, unfortunately, the leak is very large,
00:00:57
many worthy teachers,
00:01:00
well, it’s trivial that they emigrate for their own reasons,
00:01:02
and again, I can’t blame
00:01:05
anyone, I understand everyone personally, thank you, see
00:01:07
you off but it turned out that way,
00:01:11
I’m staying, well, I’m telling you who you
00:01:13
got here, you got it, let’s
00:01:16
try to
00:01:20
spend as much time as possible on the master class today, it’s
00:01:22
always my dream, and anyway,
00:01:24
I’m talking, we should
00:01:28
start talking about
00:01:30
classes now and objects, classes and objects in
00:01:35
python,
00:01:48
I specifically don’t say directly such
00:01:51
big words they want anyway,
00:01:53
they’ll probably be said
00:01:55
object-oriented
00:01:56
programming
00:01:57
next time I’ll talk about it again,
00:02:00
I’ll talk about
00:02:02
it, but now let’s get to the
00:02:04
point simpler, just one piece
00:02:06
about the bite, here’s a specific thing, let’s
00:02:11
start with what, when you use any
00:02:18
object, an integer
00:02:21
string object, then you use exactly the
00:02:23
object in other
00:02:27
programming languages ​​there is bare data, well, that
00:02:30
is, here y because it’s like a number, but
00:02:33
in fact, even for a stupid number everything there
00:02:35
is also a set of algorithms associated with
00:02:37
its addition, subtraction, multiplication, about
00:02:40
some algorithms that allow
00:02:43
this piece of memory to be interpreted and
00:02:46
somehow work with it, yes, that is,
00:02:50
in fact, there is still no
00:02:53
pure data, so let's start with what it is
00:02:56
in general the object is
00:02:59
essentially what is its idea, the object is
00:03:05
what it is: on the data,
00:03:07
or even better, write equal to
00:03:10
data
00:03:12
+ code, I mean code in the sense of
00:03:16
program code, the object is
00:03:21
precisely the combination of data together with
00:03:24
program code in a situation with numbers with
00:03:27
some- then there are also simple objects,
00:03:30
this connection between the data with code, it
00:03:32
will often be built into the
00:03:33
programming language and drug situation si si
00:03:36
plus plus there you can work with the data
00:03:41
using other code, take this and I
00:03:45
will tell you in the next semester,
00:03:47
so let’s not rush us but the
00:03:51
object allows you to beautifully connect and
00:03:55
visually see this unit when
00:03:58
your data is wrapped in a certain
00:04:00
number of
00:04:01
functions functions in this case
00:04:05
will no longer be called functions in through but
00:04:08
they continue to be in fact a pure
00:04:10
full-fledged function but there will be
00:04:12
some difference in let’s write the
00:04:13
actual
00:04:15
class now what is a class, let’s also
00:04:18
write here what a class is, a class is a
00:04:23
type of object in Python, everything is designed as a
00:04:31
class and numbers from a string, but this is not the case in
00:04:33
all languages, so in
00:04:37
other languages ​​there are ordinary types, and
00:04:41
there are classes, there are types, there are classes,
00:04:44
therefore in Python sounds strange class
00:04:47
it could have been such a law class 1
00:04:49
type I still want you to understand that
00:04:52
for other languages ​​there is also a cool type
00:04:54
of objects, that is, our objects can
00:04:57
be 1 class refusal I don’t know there but
00:05:00
Maruska Koza notka Koza Zorka they
00:05:04
belong to the Cossack class you this thing is
00:05:06
relatively abstract at the same time
00:05:09
there may be some data that is
00:05:12
attached to no specific
00:05:14
object and which are called
00:05:17
class properties of a class or
00:05:20
class attributes,
00:05:23
well, let's start with the fact that in order to
00:05:26
create an object you need to first
00:05:28
create a class of the object because the language he
00:05:32
must understand that I am an object and what
00:05:34
class it is that the
00:05:36
creation of a type of objects, the creation of classes,
00:05:39
so I must write no, I like
00:05:41
to tell procos means let’s be a
00:05:44
year class year: that means that then the
00:05:52
contents of the actual classes are written with a stop,
00:05:54
here again the main idea is
00:05:56
that the data and codes
00:05:58
belong to us, how to say, it is designed
00:06:02
very beautifully into some kind of integral unit
00:06:04
on well, I can accordingly write here,
00:06:07
for example there and
00:06:08
and there and by the way, here’s the age of the
00:06:12
abstract goats
00:06:14
starting for no age before but I
00:06:17
mean, let’s write 0 or
00:06:21
something the strange goat will have at least
00:06:23
some age 0 and there’s something else
00:06:25
she should have a Klitschko name or there’s a nickname,
00:06:28
not like a Christian name, well,
00:06:32
click Klitschko no nickname, accordingly, I did
00:06:40
n’t write it for always before, but in English,
00:06:42
in my opinion, everything I did
00:06:44
n’t know what it would be called, although okay, I’ll write it, that
00:06:47
is, then I’ll try,
00:06:48
okay, what did I want to say on and the name is
00:06:51
abstract goats, but also, honestly,
00:06:57
only you may accidentally have a
00:06:59
goat dawn, which you didn’t name, all the
00:07:00
default codes
00:07:02
are not really there an empty string is probably the
00:07:05
best solution so far the best solution by
00:07:08
the way all plus plus here you would
00:07:10
n’t have any questions at all
00:07:14
I’m absolutely sure because there we would
00:07:16
just write a type and everything in Python is not possible in
00:07:19
Python, values ​​appear only when a
00:07:21
specific value is assigned so
00:07:24
it’s simply not possible it means what’s next, but also
00:07:26
name age, what else,
00:07:28
well, weight, let’s stop here, so I
00:07:30
made several properties of the
00:07:32
Wade goat, what a story, again, listen, I’ll
00:07:37
put 0. 0 is actually
00:07:41
not necessary to write 0 at all. 0 can be just
00:07:44
zero. will already turn out to be real 0 or . You
00:07:46
can also write 0 like this, but I
00:07:49
’ll write 0.0, let it be shorter like this,
00:07:53
and sometimes insert some code here,
00:07:56
that is, shove some function inside here
00:07:58
for working with goats,
00:08:00
respectively, I’ll write df that when
00:08:04
I do it, I’ll
00:08:06
print it, for example or show, let's let him
00:08:08
show himself,
00:08:09
goat, show yourself, then look in
00:08:13
Python, the function that is embedded
00:08:18
inside the class, I loaded it into the class,
00:08:21
this is a class with its
00:08:22
own function called such functions
00:08:24
methods methods, respectively, it
00:08:28
must have an argument
00:08:31
called sat sat, it always goes the first is
00:08:38
this parameter, it
00:08:40
must be a link to a specific
00:08:47
object for which the show method is called, that
00:08:51
is, from inside this method, I actually
00:08:54
wrote
00:08:56
abstract ones here and it doesn’t actually
00:09:00
have these abstract weights of age
00:09:04
and
00:09:05
and a nickname and not a specific
00:09:07
personified specific goat object,
00:09:10
so if I want anything, first a cell
00:09:13
phone is required, yes, and secondly, it is a
00:09:18
link to a specific object for which this method
00:09:25
will be called, an object before for which
00:09:30
this method is called, for which
00:09:38
this method is called,
00:09:43
and, accordingly, when I want here
00:09:47
to print something then I will have to
00:09:50
print
00:09:52
cells .
00:09:55
name in my name,
00:10:01
but if I just want name, then he won’t
00:10:03
say, sorry, there are no such variables, well,
00:10:06
either locally, they are equal to, if I
00:10:09
write here, for example, there is equal to yes, then
00:10:12
this will mean that I am locally
00:10:14
creating a new variable inside the function, it has
00:10:16
nothing to do with the whole this is like an
00:10:19
object or an entire class does not have a
00:10:21
function ended variable is gone
00:10:25
last time I spoke briefly about
00:10:27
local variables backgammon is not enough
00:10:31
in general local changes exist
00:10:33
only as long as the function is called
00:10:36
no well if we return a link to this this object in
00:10:39
the evening there yes, then the link
00:10:43
will be saved, let
00:10:46
this object live there longer under a different name, but in
00:10:50
principle, by default, all names
00:10:54
are destroyed when the function call ends, it’s
00:10:57
clear that since the names cease
00:11:00
to exist, the garbage collector will eat all
00:11:02
the objects that no one else
00:11:04
references, so local variables are
00:11:06
traditionally all are destroyed at
00:11:08
the end of the function h, here I
00:11:10
get such a feature, look, yes, that
00:11:13
means I have a
00:11:16
village names of each such I pull its weight
00:11:20
now I won’t print
00:11:22
I have these
00:11:28
properties that exist outside of
00:11:34
this show function and at the same time they
00:11:37
tied to specific cases and I
00:11:39
will have the opportunity to create several
00:11:42
goats, that is, then I will immediately start
00:11:44
using it and now let’s create
00:11:46
Kazuo
00:11:47
and Kazakh gold,
00:11:54
respectively, in order to create an
00:11:56
instance of this class, well, naturally, an
00:12:00
instance of this class will
00:12:02
be an object, in principle, even a
00:12:04
synonym is used we can say that an
00:12:07
object is an instance of a class, if
00:12:15
you come across a definition, don’t be
00:12:17
surprised by an instance of a class, but what is a
00:12:21
class to chaos, this is a type of objects
00:12:24
because, I say again, they are quite
00:12:26
tied to each other, an
00:12:27
instance of a class is specific to the essence
00:12:31
that appears to us specifically for so
00:12:34
in order to create an instance of a class I have to
00:12:37
call the name of the class as if this
00:12:40
function
00:12:42
you see, that is, I call it as if I’m
00:12:47
talking about the great abstract goat from the
00:12:49
world of ideas to embody and it gives me its
00:12:54
embodiment which I save some
00:12:56
already concrete object of
00:12:57
luggage and I I can ask him in
00:13:01
fact I can ask him
00:13:03
print but now I’m doing this so true type
00:13:07
a
00:13:08
and he won’t say I seem like this is a goat
00:13:10
there class year will be like class int class
00:13:12
str and this is a new type you have that
00:13:17
you can to do with a goat, firstly with an
00:13:20
object you can change its attributes, I
00:13:24
can take it and say a .
00:13:27
nm is equal to note a.
00:13:35
Hey ji is equal to 2y, it’s like two years of cauldrons,
00:13:41
so I took it and milked it. By the way, you can
00:13:44
do it like this, yes ah.
00:13:47
go to equal a . hey ji plus 10 and plus 2
00:13:55
although years under + 2 are not added to, after
00:13:58
all, people and animals are
00:14:01
one year each, so but I will write
00:14:04
in abbreviation plus equals 1,
00:14:06
but let’s move on, that is,
00:14:11
in short, I have the ability to access the
00:14:13
attributes of their changes I I can create
00:14:16
another goat and if I equal the year
00:14:25
accordingly and put
00:14:28
some other name there there is a note of dawn
00:14:33
then b.
00:14:35
age is equal to 1 I can now work with
00:14:43
punches like these with such
00:14:46
valuable aggregates, there’s a whole bunch of different
00:14:49
properties, maybe there can be a
00:14:50
lot of them, for example, there’s a game object called
00:14:52
Arc, and he also has Shelby and
00:14:55
some hills and so on further so
00:14:58
force and much more position
00:15:01
exposure y it in short it can
00:15:04
have a lot of properties and for a second
00:15:06
and inside these functions which are
00:15:10
called methods let’s
00:15:14
consolidate these terms now to achieve a
00:15:16
class function called class methods
00:15:19
and this is a set of attributes that’s what
00:15:25
’s called attributes,
00:15:27
or properties, before class attributes and
00:15:35
attributes and methods are accessible through a dot,
00:15:39
that is, if I want to access an
00:15:41
object attribute, I say b there. on his
00:15:46
naturally a. name is different
00:15:48
to another object, but both of
00:15:52
them have the opportunity to call the show method,
00:15:56
and I will no longer need to
00:15:58
list and say a .
00:16:01
show and continue to list in parentheses what
00:16:06
exactly he should
00:16:08
not have, I just close the bracket and do
00:16:12
n’t even indicate the letter here in brackets, but
00:16:17
well, in the sense of sitting down,
00:16:18
that is, the parameters of the sal of he
00:16:23
rushed inside by default, that is, the
00:16:26
call format itself is like this: we have
00:16:29
a parameter and it is, as it were, sent inside the
00:16:32
method automatically as a pair, the first
00:16:34
parameter of this method is automatically
00:16:36
so when you call it you will see 0
00:16:39
parameters and at the moment when you
00:16:42
describe the method there will be a parameter
00:16:47
methods may have additional
00:16:49
parameters that are required then I
00:16:52
will put it here and write more there are
00:16:55
some names of parameters then I will
00:16:57
have to list these parameters here
00:16:59
time to ask the question
00:17:11
to the next poppy the following under the
00:17:13
topic which will be on the board right
00:17:17
now for a second well, in
00:17:18
short the point is that once again yes that
00:17:21
I work with objects in a very convenient way
00:17:25
and all the responsibility
00:17:30
associated with these aggregate
00:17:34
processes, like
00:17:36
showing a goat and just milking the goat
00:17:41
or increasing its age, celebrating the
00:17:43
goat’s birthday,
00:17:44
this is all responsibility for everything that
00:17:46
happens to the goat, for everything that happens
00:17:47
with these aggregate logically integral
00:17:52
data, that is, they are for us in essence of the
00:17:55
problem being solved, for us they are an
00:18:00
understandable entity, either humanly
00:18:04
or we came up with this entity, but in
00:18:05
any case, a certain set is given that
00:18:07
characterizes one, how to say
00:18:10
one piece of the problem, one piece of our
00:18:13
task, the object is very often a
00:18:15
convenient entity, highlight, highlight and
00:18:18
encapsulate responsibility for
00:18:22
the processes occurring, I will say inside the
00:18:24
goat class,
00:18:26
it encapsulates them as a scanf bag like that,
00:18:28
yes we all do, and if suddenly we want to
00:18:33
improve the goat, we must
00:18:36
create or change the methods of the goat
00:18:39
and not some other functions that are
00:18:42
located somewhere else in the project, that
00:18:44
is if it concerns a goat, then
00:18:46
we open the basic class,
00:18:47
this is essentially what is not called until the
00:18:49
encapsulation of responsibility, in short,
00:18:52
okay, let's move on, let's start, I explained the
00:18:55
next question,
00:19:00
what should we do, what will happen if I call a
00:19:04
printout when we have an object object and
00:19:07
nothing has yet been assigned an id or name has
00:19:09
not yet been assigned, which means when I’m telling
00:19:14
you this now, this is telling the idea, that’s
00:19:19
what it is, look, we return to the fact that here’s the
00:19:23
problem teaser oval at the beginning,
00:19:26
because there really is no abstract
00:19:29
age, but what if
00:19:31
such a situation really arises, I took it
00:19:34
and didn’t assign anything at all to the sub class and
00:19:39
I’m trying to display it there, it’s a nightmare, what a
00:19:43
horror, what’s the problem, but the fact is that I
00:19:47
’ll see how to say the parameters of abstract
00:19:50
goats, and this is actually not good for
00:19:54
good, I should not have the right to
00:19:57
create a goat
00:20:00
without age and without a nickname, but there was 1 without a
00:20:04
nickname, you can but let's
00:20:05
try to think differently, what if this is a
00:20:08
student whom I calculate into the
00:20:10
MVT student database and so I create a
00:20:13
class foo so that I have it there in my
00:20:15
program before class student and my student
00:20:18
and he should be protected from such a
00:20:23
creation that I I can say about the
00:20:25
same student, yes, and I already have it all in the
00:20:28
database, abstract without parameters,
00:20:30
this shouldn’t be good for
00:20:32
students and we enroll only when they
00:20:34
have a surname, first name, middle name, age and
00:20:37
documents, okay, at least surname, first name,
00:20:39
middle name, age, let’s just conditionally by
00:20:41
analogy, so that they don’t write off the board now,
00:20:44
you understand, yes, I have to do something so
00:20:47
that the interface for creating an object
00:20:53
requires the mandatory entry of its name,
00:20:57
but as soon as I close this bracket,
00:21:01
syntactically insert nothing here
00:21:03
anywhere, so I need to actually, as it
00:21:07
were, build in getting the parameters for
00:21:10
creating this particular one an instance of
00:21:12
the class here
00:21:13
now will be described there yes right here right here here
00:21:17
here when creating I
00:21:20
’ll write a little here and also
00:21:23
you don’t that is here and I
00:21:27
have to write some parameters here yes
00:21:29
well let’s say I’ll just
00:21:31
call it Masya and Vasya to him 17 years old,
00:21:35
welcome to fob, so I have a
00:21:42
new one, how to say in applications to a
00:21:44
programming language, I want it to be able to
00:21:46
receive design parameters, but
00:21:53
someone should do this, initializing attributes, a
00:21:58
special method that will be
00:22:00
called a constructor, although in Python
00:22:03
it is called and not, but in the literature everything
00:22:06
Equally, in essence, this is a
00:22:08
constructor understands about the constructing
00:22:12
method of constructors, in short, now I
00:22:20
will not create a single
00:22:25
attribute like this, and I will create all the attributes inside a
00:22:31
function, in this function there will be a
00:22:34
specific name 2 underscores
00:22:37
since I require quite specific
00:22:39
things to receive the parameters in
00:22:42
brackets when creating an instance, then I
00:22:45
need, accordingly, well, so that
00:22:47
the name of the package, yes, well, as if it were
00:22:50
specific, because it will not need to be
00:22:52
called, that is, this is this, this is the
00:22:56
transfer of parameters to the constructor
00:22:59
for this, the parameters of the constructor,
00:23:12
the parameters of the constructor, respectively,
00:23:16
I need inside the class,
00:23:19
that is, pay attention to this
00:23:21
use of objects of objects of the
00:23:25
class that I am creating here, and this is the
00:23:27
creation of a class for its use,
00:23:30
so I actually tie these things
00:23:31
now as it turns out from the point of view of the
00:23:35
class, which means there are no 2 underscores and very much
00:23:42
in parentheses the first parameter I
00:23:45
will write is selfie absolutely correctly, don’t
00:23:48
ever miss it, don’t forget about it, and
00:23:51
continue to do so, but I’ll write their
00:23:56
name vertically, and
00:24:01
the bracket closes: vertically, well, that’s
00:24:07
also good, we see that we have three
00:24:10
parameters, one of which is the strength of what
00:24:12
the task of the init method is what its task is,
00:24:16
its task is to use these
00:24:20
parameters to carry out with the object sat
00:24:24
which is constructing the father and until the
00:24:28
init method
00:24:31
of initializing the object is completed, the object, as it were, has not
00:24:34
been created yet, it is clear if suddenly
00:24:37
an accident occurs during the
00:24:39
initialization process, then what is this called in the
00:24:42
middle of the process of enrolling students, the
00:24:45
database turned off the electricity,
00:24:48
well, there is such a thing as transactional and the
00:24:50
model is given now this does not
00:24:53
concern us at all, but the point is that if we
00:24:55
half enter you gazelle Vasya species
00:25:01
without age, then problems will arise
00:25:03
in the database itself,
00:25:06
therefore database they do, well, at the
00:25:09
moment we are not talking about a database, but in any
00:25:11
case about an information system,
00:25:13
essentially yes within the framework of the program, but
00:25:16
nevertheless, an object cannot be considered
00:25:20
created if I was in the process
00:25:23
at the moment when I was
00:25:25
creating here new name attribute
00:25:29
sat down flame I'm creating here there was no
00:25:33
name attribute until I assign it to it
00:25:36
and so I assign name to it,
00:25:41
assign it outside it and thereby I
00:25:44
pass a link to some
00:25:47
external object inside I assume that it is a
00:25:50
string although I don’t checked this,
00:25:53
maybe by the way, at this moment it would be necessary to
00:25:54
check what if there isn’t a line in the valley,
00:25:56
now we’ll forget it, but nevertheless, the point is,
00:25:59
I forward a link to the line name
00:26:01
that they will give me from there, and the
00:26:05
name name appears in the object space in the
00:26:10
self object appears on it then I
00:26:11
would like to know exactly what they are constructing here, so that’s why
00:26:13
I was talking about transactions, if
00:26:16
I suddenly have
00:26:17
here, and by the way, the constructor
00:26:19
can actually
00:26:21
calculate something that is customary for you, but suddenly in the
00:26:24
process it divides something by zero and by
00:26:27
arithmetic problem Azeroth division
00:26:30
based and the python flew away, bending our
00:26:34
thoughts, flew down with an error, the program
00:26:36
falls out, well, in fact, errors
00:26:40
inside the program can be processed, but
00:26:43
in fact the most important thing for now, remember
00:26:45
that the object until the constructor
00:26:47
ends until we come out here is
00:26:50
not even here, yes, from this
00:26:53
moment on, the object is not considered created,
00:26:58
okay, I also wanted to say about the villages,
00:27:01
Linda sat down and equally
00:27:04
hey ji, and thus I threw away these
00:27:07
parameters, quite by the way, I’m saying again,
00:27:09
maybe there is some additional
00:27:10
functionality here, well, for example, I don’t know
00:27:13
there is some kind of seal and a prince, then
00:27:15
we are there, conditionally, I’m just there now with a
00:27:20
plus sign name , in quotes, the plus sign night of
00:27:25
the substance is credited,
00:27:27
by the way, in Python there is no normal
00:27:31
way to delete objects, well, some kind of
00:27:34
grandfather of a destructor, all plus plus it is, and
00:27:38
in Python there is a method that should be
00:27:42
called when reconstructing an object, but
00:27:44
let’s say in Python the mechanism itself for this
00:27:47
reliable closing of some resources is
00:27:49
organized
00:27:50
otherwise we don’t care now at all, it’s
00:27:53
not part of our problem, but the point is that
00:27:56
again, yes, now I’m creating
00:28:00
attributes inside the constructor, these are the
00:28:04
attributes
00:28:05
firstly, they become mandatory, that
00:28:08
is, when trying to create like this, I
00:28:11
took my sister, I’ll say yes, when trying to
00:28:13
create a student like this,
00:28:15
if I have already described a
00:28:17
constructor like this and no, then when trying to create
00:28:21
just a student like this, at the
00:28:24
execution stage at this moment I
00:28:26
will have an interpreter going on strike and shouting,
00:28:29
how about these are the constructor parameters,
00:28:31
let me create it and you have a very clear case, this is
00:28:36
what at this moment, right here, when
00:28:39
I made a goat and started typing everything, I
00:28:43
may have a hidden, not obvious error, the
00:28:48
programmers and I I hope you, too,
00:28:51
programmers really don’t like hidden
00:28:54
errors, but here it’s very clear, we
00:28:59
stated that for our class, these are
00:29:01
the parameters, here it is, and it requires these
00:29:04
parameters when creating, and the compiler-
00:29:06
interpreter in this case
00:29:08
helps us understand these requirements,
00:29:11
so clearly drinking away the prescribed ones
00:29:14
parameters are better than implicit dojen python
00:29:17
clearly better than not I don't answer a good question
00:29:24
good c plus plus do
00:29:28
in some programming languages
00:29:32
you can write several constructors in
00:29:35
python several constructors cannot be written in
00:29:39
python constructors no one like
00:29:43
including in python you cannot create several
00:29:46
functions of the same name in python there is no
00:29:49
overload by the name of the function,
00:29:54
respectively, and there is no possibility
00:29:57
to create several and not so let’s say the
00:30:01
type is possible, but
00:30:04
only the last one will actually work, which means there are also such
00:30:08
rules of politeness, yes, I can take it at any
00:30:11
time and stick it to a
00:30:14
student, I didn’t know there, but I have a student
00:30:16
and I took it and I glue a new attribute to him
00:30:20
directly on the new attribute and I also say
00:30:24
you will have a tail I don’t
00:30:29
know tail physics I don’t know in short
00:30:36
the meaning is that Abilio has decrees up to the ear per
00:30:39
year I’ll take it glued and r equals 5
00:30:44
fifth leg case
00:30:46
so the language allows this in python, a
00:30:52
specific object may differ from
00:30:55
representatives of its class by the presence of
00:30:58
additional attributes,
00:31:00
but the rules of politeness require this, don’t
00:31:05
do this, don’t do that, that is, the language, he
00:31:08
once again said, is quite soft in this
00:31:10
sense, new attributes can be created not
00:31:13
only in the constructor, but the rules of
00:31:15
politeness say that that new
00:31:17
attributes can only be created here, that is,
00:31:21
this is this place where it is created
00:31:24
created again, I will write that this is
00:31:27
actually a constructor, this is a constructor and
00:31:32
all new properties,
00:31:35
new attributes should appear exactly
00:31:38
there,
00:31:39
and only here new
00:31:48
attributes should be created, the fact is that it is a
00:31:54
constructor this is the method that will be
00:31:57
exactly called for any instance of the
00:31:59
class and this will ensure their uniformity
00:32:03
when working with a whole array of lists of
00:32:07
many of these same entities, the student
00:32:10
there we can assume and even
00:32:14
be sure of the existence of the
00:32:17
corresponding attributes if we
00:32:20
glue these attributes like- then along the way we
00:32:23
may find ourselves in a situation of having
00:32:25
5 legs decrees, well, in principle, the leg attribute leg
00:32:27
is clear, is it
00:32:38
necessary, is it necessary?
00:32:45
There are things
00:32:47
that both in society and in
00:32:51
programming are done on trust and
00:32:54
there is a position such as conservatism, the
00:32:58
boxes are conservative but in the sense of morality
00:33:01
I believe that morality does not
00:33:03
pass over centuries and millennia,
00:33:05
but in the sense of how to say
00:33:11
politically, I am very liberal, I believe
00:33:13
that freedom is much more important than lack of freedom,
00:33:15
and only in freedom can something
00:33:17
develop, and in this sense,
00:33:21
there is such a thing in programming balance until
00:33:23
you allow too much until they start writing
00:33:26
all sorts of garbage
00:33:28
too much you forbid food very
00:33:31
strict framework of requirements
00:33:33
here in the same C plus plus in this
00:33:35
sense it is a compiled language and everything is
00:33:37
through strict typing and you are not scared, for
00:33:40
example, by what you can take and put in Python
00:33:42
there, instead of name, not a string,
00:33:44
but put 18 here for me, Vasya, and not
00:33:48
be 17 as me Vasya as HIV, a
00:33:51
stupid person
00:33:53
can use it like that, but only then
00:33:55
it breaks at some point when there are
00:33:57
thousands plus equals 1 and it turns out Vasya plus
00:33:58
equals de well, that is, the error will come out in
00:34:02
any case, the thing is that there
00:34:06
is still some balance in both a and
00:34:08
compiled languages, they create the illusion
00:34:12
that the program does not need to
00:34:15
be tested, that the program
00:34:19
and since it was compiled means it
00:34:21
is good and this is not a program in C
00:34:25
plus plus it is necessary to test in exactly the same
00:34:27
way as a program in Python,
00:34:29
they have the same problems with
00:34:32
digital security, they can be
00:34:35
compromised like programs in
00:34:37
Python, and even
00:34:38
there the situation is even worse, sometimes the situation is
00:34:40
therefore it compiles, it protects, but there is
00:34:43
nothing, this is what we would ban
00:34:50
again you have a piece of charm
00:34:52
there is one for charm put yourself in the
00:34:55
patches of the community vishnu who didn’t put
00:34:58
it you don’t have to do it
00:35:00
but nevertheless I will say about him there is
00:35:03
this little man in the lower right corner
00:35:05
who is looking at you
00:35:06
you can ask and he will tell you everything
00:35:09
he comments on what is called, yes, that is,
00:35:10
about every line, but also underline it with
00:35:12
red, yellow, and blue, that’s
00:35:15
accordingly, and he finds fault, if you want,
00:35:18
you can turn him half a turn, he
00:35:20
will start to find fault only with critical
00:35:22
things, if you want, you can
00:35:24
turn him completely away from this and he will be silent,
00:35:26
shut up, you understand you can
00:35:28
actually really rape a
00:35:31
programming language, but it’s better to follow the
00:35:34
rules of
00:35:35
pep 8, the rules of readability, the rules of
00:35:38
documentation, the rules of good manners,
00:35:42
and here’s one of the rules of good manners about
00:35:45
which, by charm in particular, he will
00:35:46
remind you when he sees something like this, he
00:35:48
will emphasize this to you and say are you
00:35:50
sure,
00:35:51
but like everything plus plus there you can also
00:35:54
do static crap and fish deventer
00:35:56
pride fire yes yes yes yes and in fact
00:35:59
you number is clear and such this is something else I'll
00:36:03
give a lot of things you can do and as
00:36:07
the compensator said he too you
00:36:09
should shut up and keep quiet makes
00:36:11
madness which you write to him
00:36:13
okay, in short about the constructors I said
00:36:17
about I didn’t say about the difference in attributes
00:36:21
now a little more drawing that I can’t
00:36:23
draw on the screen anymore the
00:36:26
thing is that look here I’ll
00:36:29
draw this thing with goats there is an
00:36:32
abstract class goat
00:36:35
it’s a class it’s said year as such
00:36:39
let me write the year at the top and
00:36:42
accordingly it has a class
00:36:46
class the thing is
00:36:48
that a class in Python
00:36:52
are objects of a class in Python
00:36:57
are objects they belong to a
00:37:01
class class but they are classes which
00:37:06
means they are objects of a class class it’s
00:37:08
clear if I ask type year and
00:37:12
so I’ll ask who exactly is
00:37:14
this year tell me you know
00:37:17
actually the year is a class it’s understandable therefore
00:37:20
but this is basically a normal situation
00:37:22
Sean it’s clear but it also means that this is
00:37:25
what the class itself has as such for the
00:37:29
goat class it after all, it’s not quite a
00:37:32
concrete class anymore,
00:37:34
but it has its own namespace, which is why
00:37:37
I have the opportunity
00:37:40
to create methods that are universal for all
00:37:43
goats,
00:37:44
it’s clear for the dawn for a note,
00:37:47
respectively, and when I wrote these
00:37:49
now
00:37:50
and name and Wade there, then I have there
00:37:53
is both age and name which with
00:38:01
being names refer to objects
00:38:04
that are named accordingly
00:38:06
in space are objects needed 0
00:38:09
what is there an empty line name2 empty line
00:38:13
star and stir listen and I Wade now won’t
00:38:18
draw on it there will be nothing
00:38:20
or there here 0.0 I’ll write
00:38:23
when I create an instance of a goat, a specific
00:38:27
object kazaa, what I’m actually doing is I’m
00:38:32
already making an object that has the class year
00:38:37
goat and so due to the fact that the object
00:38:41
and every object in Python remembers what
00:38:44
type it is, it remembers that it’s actually of the
00:38:48
class Kazan I will refer to this object
00:38:52
somewhere from my main
00:38:54
program. I have a main
00:38:56
namespace in the project, we are
00:39:00
main, respectively, and my
00:39:02
object a refers to the object created by
00:39:05
goats, which by the way is still nameless at
00:39:07
the moment,
00:39:08
but nevertheless the name a refers to this
00:39:10
object is in the namespace of the object
00:39:15
that I called the letter and now there is not a
00:39:18
single name there is not a single name there,
00:39:23
but if I ask, and in Python you can
00:39:28
ask
00:39:29
an object and which ones do you have exactly
00:39:32
and imagine that at this
00:39:34
moment I ask at this moment I’ll
00:39:37
take it and ask him der and I’ll
00:39:41
insert an arrow here der
00:39:44
and this is one of the possibilities of
00:39:47
introspection, that is, looking at
00:39:50
yourself as a mirror, the Python interpreter himself
00:39:52
in the process of execution, to
00:39:54
say something about
00:39:55
the self, this is an opportunity to find out and what kind of
00:39:58
attributes and methods does the object have in general
00:40:01
and which I give there will be quite a lot of
00:40:05
built-in ones that you will be surprised and
00:40:07
say wait I didn’t create them
00:40:09
I have 1 2 3 4 on and there’s a lot of everything there will be
00:40:13
some more built-in methods
00:40:15
but none the less Let’s say, a lesser man saw
00:40:19
that the object itself doesn’t have a single
00:40:24
name in the namespace; at the same time,
00:40:27
if I did something like this, for example, yes, I would
00:40:30
create it and immediately use it. I can do a show, how can it be like
00:40:34
this, it shows me these numbers,
00:40:37
so the trick is that in Python
00:40:41
there is a process and when a specific object is created,
00:40:44
I don’t have any assignment
00:40:49
here in this namespace, there is no
00:40:51
assignment, which means there is no creation of new
00:40:54
objects from for attributes, which means
00:40:58
it turns out when I’m writing let’s
00:41:01
do it for this let it be b mad
00:41:04
rendered this yes to for which I have
00:41:06
n’t created anything yet, no attributes there and
00:41:08
so I say b. Prince
00:41:11
let's
00:41:13
print I just want
00:41:17
to print b regardless of the show.
00:41:19
age I am referring to an attribute that is
00:41:25
not inside the object in the namespace of the
00:41:28
object there is no name ash
00:41:30
but not finding a
00:41:34
name among the instance attributes, Python
00:41:40
will go looking for speech in the
00:41:43
class namespace among the class attributes, the
00:41:47
logic is clear, yes, that is, instance
00:41:51
attributes are specific for specific goats,
00:41:54
and there are abstract ones which, how to say
00:41:58
the services of the class itself as such, so
00:42:02
according to the logic of things, why did the
00:42:05
students correct this problem with decrees, no,
00:42:07
in fact, there is no abstract
00:42:11
age, no abstract name, no
00:42:13
abstract weight, in
00:42:14
general, they would actually
00:42:17
be here and not Each instance must have them,
00:42:19
but not abstractly
00:42:22
abstractly,
00:42:23
there must be
00:42:25
construction methods, the show method, it is
00:42:28
really universal for each
00:42:30
case, this is done in absolutely the same way,
00:42:31
yes, yes, there can be things
00:42:35
that are at the level of all goats globally, they are the
00:42:39
same constant number of legs
00:42:46
mix lex
00:42:48
us a and there will be four
00:42:52
constants, rather, a place there in class
00:42:57
attributes again, this is an important concept, you
00:43:00
need to be able to name and understand them, this is where the
00:43:03
so-called
00:43:05
instance attributes live, instance
00:43:11
attributes and methods,
00:43:13
well, now we are mainly talking about attributes, in
00:43:17
fact, from instances of methods in a
00:43:19
good way the instance should not be
00:43:21
maintained differently from all the other goats in
00:43:23
this when the show says it’s strange,
00:43:26
although there are opportunities to once again replace a method
00:43:29
on a specific instance, like the
00:43:31
ability to add a new case attribute,
00:43:33
yes, it is theoretically possible, or even by the way,
00:43:37
to replace a constant on a specific object of
00:43:39
this class too in principle, you can
00:43:42
specifically find it and your max alex
00:43:44
sayz will be 5 okay, but this is again like that
00:43:46
and some were worn with the tongue in a
00:43:48
good way, by the way, the constants themselves as
00:43:50
such are not even in the den in a good way,
00:43:52
but there are some methods of naming them
00:43:55
that help you realize that this is a
00:43:57
constant and and not
00:43:58
shouldn’t be touched okay and this is to get
00:44:02
if this is an instance of this these are class
00:44:05
class attributes let’s finish with this
00:44:11
and what I would like to tell you
00:44:16
and show you, imagine what I’m
00:44:19
going to listen to and I don’t even know to be
00:44:22
honest How can I start? Maybe it
00:44:24
makes sense to start completely from scratch,
00:44:26
maybe I can name the project, I can immediately
00:44:28
open there a draft of the project that
00:44:30
you will have this week, not the
00:44:32
next week, now you often add more
00:44:34
balls, but when you see this, you will
00:44:36
immediately want even balls it’s possible
00:44:38
to write differently,
00:44:40
okay, let’s start sequentially,
00:44:44
balls conditionally, yes, I’ll try to make
00:44:46
balls from scratch in the garden, I didn’t have any, there
00:44:51
were some files, let’s
00:44:54
copy it, so it’s me, but I
00:45:04
can do this, Nick Methyl’s old collections, so
00:45:27
okay, that means everything had to go I
00:45:30
think so about the hulk us lecture is number 7
00:45:37
lecture 07
00:45:38
and I wanted to copy some example from 6
00:45:42
no from 5 probably where
00:45:46
Hello World was it was actually our
00:45:49
library so that we don’t have to
00:45:52
remember how it was done there because the
00:45:56
seventh means and I’ll now drag this Hello
00:46:01
World to you what it’s called what you
00:46:07
call it I’ll have maybe a us more
00:46:11
balls. Pai and so I apologize
00:46:20
automatically vim I enter, I would like to
00:46:23
open in this
00:46:36
so and so, so we had a front
00:46:41
kinder import asterisk and a
00:46:45
couple of handlers, which means I will need an
00:46:48
exit character, I don’t need it and I won’t link it to
00:46:53
this, I’m sorry not to the button, I
00:46:58
can actually remove the button altogether, which means
00:47:00
I’ll add a little modularity here, that
00:47:03
is, I would actually like to bring these things
00:47:04
related to initialization
00:47:06
to more to
00:47:10
say, on the other hand, I need the
00:47:13
root variable to be a global variable of
00:47:16
the module, I’ll now do the following I will send things
00:47:20
related to initialization
00:47:24
to the main function in which I
00:47:32
will make the root variable a global variable
00:47:36
modules and this thing I am sending here
00:47:40
means accordingly what I am doing and
00:47:42
flame remember this I am doing so that
00:47:46
my bolt can be there if there are any
00:47:49
inclusions behind it to spoil it’s equal to main a
00:47:55
little bit it’s a little bit modular but it’s
00:47:57
still a little bit call the
00:48:00
main function so the program ends
00:48:02
you know I’m removing the unnecessary things I’m
00:48:05
removing the unnecessary comments binding
00:48:07
handlers to the event this is already
00:48:10
clear I’ll remove the same thing remove the corner label is
00:48:12
pretty cool label our label with I wo
00:48:14
n’t create any instead of a label I will
00:48:17
create canvas and by the way not front ken
00:48:20
torin por asterisk
00:48:21
I will still import do kent rstk
00:48:25
with a short name but still to make it
00:48:28
clear that this is in a separate library
00:48:31
where these things are located respectively I will
00:48:34
not create canvas, but... . canvas
00:48:37
canvas I will create it on the main
00:48:40
window so I am registering darude this is
00:48:43
not Holloway Balakin you by the way,
00:48:45
it would be good for the canvas to be global too
00:48:47
because then I will go to the same
00:48:50
canvas I have one in this module and it’s good for
00:48:53
me to remember this
00:48:55
canvas object so that then we continue to work with it,
00:48:57
so I also made it global;
00:48:59
in general, global variables
00:49:02
are evil; global variables are actually
00:49:07
evil, or let’s say there should be
00:49:11
as few of them as possible, and this violates the principle. It’s
00:49:14
clearly nervous; when you transfer
00:49:18
information through global
00:49:20
variables, it reminds as if
00:49:22
you called your friend or a plumber
00:49:27
to help you perform some
00:49:28
activity
00:49:29
and the parameters of his work are written on the
00:49:31
fence and you died global changes
00:49:36
look there, you get the feeling that well, of
00:49:38
course, of course I can, but every
00:49:40
time I can go without assigning new
00:49:43
parameter values ​​there yes, I can
00:49:46
say one place further only
00:49:48
call but this is not a good
00:49:53
simplification of the problem because the next
00:49:57
programmer will simply not know about the
00:49:59
existence of global variables or
00:50:01
that as a result of the function
00:50:02
the plumber writes about his problems on
00:50:05
the fence and also a pipe has burst
00:50:08
about this, you won’t get liquor as a result parameter,
00:50:11
not as an exception that
00:50:14
will crash and crash the program there, or
00:50:16
process it, so to speak, somewhere in the
00:50:18
global variable r, as in the C language,
00:50:21
global changes appearing r at
00:50:23
some error number magically, and you
00:50:26
even you don’t know, continue the program
00:50:28
continues to work, a typical situation,
00:50:30
but the pipe is broken, okay, what I want to
00:50:34
say is to protect now, I briefly
00:50:36
described what I’m doing and quickly
00:50:37
put it to the point of creating an instance of the
00:50:39
actual ball that will be on
00:50:41
the canvas, these balls will also be there now,
00:50:43
I may even have different ones will be shorter
00:50:45
meaning that's what I'm creating a canvas a ghost I
00:50:48
need to the canvas I will need to bind
00:50:52
events and also the hall actually I need
00:50:55
for what is it called packing
00:50:59
pack accordingly already indicated in
00:51:04
which widget so I
00:51:06
didn't have any parameters there were absolutely no
00:51:08
parameters the only widget is the canvas so well and let
00:51:12
me have a handler for the event for now, yes,
00:51:14
it’s a mouse knu, after all, let’s
00:51:16
call him not a handler, meaningfully, any
00:51:18
function must correspond to the
00:51:20
essence of the
00:51:23
essence of the nickname in this sense, it can
00:51:26
sometimes be the best, but people have a nickname and
00:51:30
sometimes it doesn’t say much about the bouncer conditionally yes, but
00:51:33
if I immediately understand what he does
00:51:35
or is a nerd, it’s also clear, well, in short, the point is
00:51:39
that when you create a function,
00:51:42
call it abstract and this is a
00:51:44
handler, this means saying almost
00:51:46
nothing, so I’ll still write mouse click
00:51:51
angler, but for good reason it’s not even just a
00:51:55
mouse click handler, yes, and this is a canvas,
00:51:59
that is, I emphasize here that in general
00:52:01
we process up to a canvas crippled handler,
00:52:05
accordingly, on the floor, I
00:52:07
will put a gate on the canvas on it and
00:52:09
call it, let’s check that
00:52:11
this thing is working for me globally, and now a
00:52:14
canvas has appeared on a gray one there you can
00:52:17
do something on this canvas, let’s
00:52:19
now check that you can do something on the canvas
00:52:21
there, it can do something that you didn’t have,
00:52:25
and what by the way you will need to do
00:52:27
this week is processing events by
00:52:29
time, maybe someone has already done it
00:52:32
well, let’s start and now
00:52:34
I’m doing straight water in the global and no, I’ll
00:52:38
register the appearance of a new ball, which
00:52:42
I do before leaving for the main loop, but
00:52:45
after creating the canvas
00:52:47
I’ll create this is how I create a ball a ball
00:52:50
is actually three things yes it’s
00:52:53
x y and radius yes, here's x y radius 3 3
00:52:57
parameters if the first option I can
00:53:01
make it global variables of the module,
00:53:03
let's do it, but how to go down then
00:53:06
from the handlers you will need access to them, which
00:53:08
really means you will have to and took it as
00:53:10
global variables,
00:53:12
let's make this not an object on the
00:53:14
global one, I'll do one more instructions so that you can then
00:53:17
joyfully delete it quickly global x y z
00:53:20
and then I’ll write right away I almost don’t like it, I feel
00:53:23
bad somehow on not an object on yes there is
00:53:31
such an option for writing comments
00:53:34
like that doo-doo-doo well really go there
00:53:38
imitating to do something and then there is this
00:53:40
to rewrite, that is, it’s more likely no longer
00:53:42
breathing badly somehow yes here you actually need to
00:53:45
do it as it’s called there I
00:53:54
should have said the words I
00:53:56
last time he said whether factory
00:53:59
refactoring do object and
00:54:02
refactoring 0 and object-oriented
00:54:07
refactoring means pronounced
00:54:10
last time, refactoring meant
00:54:12
rewriting the program code while
00:54:15
maintaining the functionality; there was
00:54:18
no addition of anything new;
00:54:21
there was no new functionality, but the program
00:54:25
became more readable; everything was
00:54:27
better organized, that is, it did
00:54:30
n’t have a front-end and the back-end
00:54:36
became better and more well
00:54:39
thought out. light and on the floor as a
00:54:42
harm to the balance of the port there was a program here
00:54:44
actually or in fact very often
00:54:46
the program cannot develop further due to the fact
00:54:49
that it is written poorly inside
00:54:51
and if it is written inside it is great
00:54:54
good okay listen our time is
00:54:57
running out we are moving forward
00:54:59
what are we doing next that means I’m
00:55:02
now creating this new object here, yes, I’m
00:55:07
now X, I’m equal to random, but I need to
00:55:12
naturally there from the brand, I’m now
00:55:17
renting in that, I’ll drag it there, I’m doing
00:55:21
rent and cheese here, a random number in the
00:55:24
range,
00:55:25
but honestly, I don’t remember in my root.
00:55:30
thank you Ruth, in my opinion height is what they
00:55:38
should be called in theory no no no
00:55:44
no window
00:55:45
hello hello in the info you see yes screen
00:55:49
height to screen you really like
00:55:57
adding well in short screen haida there there
00:55:59
is a parameter gift and in accordingly
00:56:02
we will have this for igreka parameter and
00:56:05
also rent in the 1 1 will listen and I’ll
00:56:08
probably still
00:56:10
create this separately, I have a long line, it
00:56:11
turns out to be long, why do we create them separated
00:56:13
by commas, in fact, it
00:56:16
can be useful there screen
00:56:18
you then, and therefore a certain radius, please
00:56:27
sorry rent in you should be starting
00:56:29
from starting from let's say one to
00:56:31
starting from one to so and the radius is
00:56:36
something rent and
00:56:40
in the range from 10 to
00:56:42
there the charms want 20 and the creator of the
00:56:48
actual cda object means and by the way
00:56:50
the link to the bolt object should to be also
00:56:54
global they have the ball itself,
00:56:56
go on the canvas, by the way, the bolt is not the
00:56:59
image of the ball itself, it’s like an
00:57:02
avatar, its visual representation, yes, it’s a
00:57:05
physics model, so I’ll add here
00:57:08
that the
00:57:09
ball actually go to the canvas has always been,
00:57:13
maybe full, was completely Balkan
00:57:16
you go, yes, in short, that’s all I’m
00:57:19
writing, it’s actually not very good,
00:57:20
so let’s be honest, I
00:57:22
kept you thinking things, I want ball
00:57:25
id gray,
00:57:26
what’s up and I should say canvas canvas
00:57:30
.
00:57:31
kreed now it won’t tell you creed fall
00:57:37
means in what position in position x minus
00:57:41
r
00:57:42
to y minus r x + r a y + r well, there also
00:57:51
seems to be a color that needs to be indicated, I don’t
00:57:53
remember how to do it there, but the color indicates
00:57:56
the feltton will be indicated yes phil grind
00:58:01
green balls will be launched then, ok, let's
00:58:03
check that it is, in principle, created and
00:58:06
unsupported type where a + b range because
00:58:12
where again and I needed brackets ha
00:58:22
ha of course this is a method that needs to be
00:58:24
called to find out in my opinion like this,
00:58:27
come on, why is there some kind of silence
00:58:36
he didn’t write where yes, but I can
00:58:38
actually ask here what it is equal to and
00:58:40
what y is for, apparently he still doesn’t have the same
00:58:43
dimensions there, it returns them, it’s a pity, well, maybe
00:58:47
the canvas knows its width by height, or one in the
00:58:50
same place can somehow be his with this diameter
00:58:52
to how to do it and
00:59:02
Jimmy 3 to
00:59:04
it you can specify specific dimensions
00:59:07
accordingly there is conditionally there 1000 x in
00:59:11
the date not 1000 smaller 800 x 600
00:59:15
and what is the problem
00:59:21
like shop numbers were numbers from 800
00:59:28
plus in quotes x above in python
00:59:33
you work before there is some, maybe
00:59:35
you can read it for a long time to study if there is some
00:59:37
painfully correct way, but
00:59:39
this is this one and the thing for which you
00:59:41
should not rack your brains, it seems to me that if it does
00:59:45
not affect the performance of
00:59:46
the program because this thing that is
00:59:48
produced once
00:59:49
needs to be optimized those parts of the program
00:59:52
that are executed millions billions of
00:59:54
times, there needs to be strict optimization, maybe
00:59:56
even a change of programming language from Python
00:59:58
to this, you will
01:00:01
call a function from Python that is written in this,
01:00:02
it will serve the bottleneck, it doesn’t
01:00:04
matter, let it be like this and
01:00:07
everything is clear, yes please yes and again
01:00:11
this is in principle yes it will be necessary the 6th will be
01:00:12
constants yes there is some kind of global you yes
01:00:16
you I will write do it these are the constants
01:00:22
glasses I will write them here here you are above the
01:00:24
hate is equal to 600
01:00:28
like the time of this summer these are ours
01:00:30
objects we may not be able to reach, at least I’ll
01:00:34
launch it so it’s flying, yes, I
01:00:36
’ll still tell you more about objects of
01:00:38
the class, then at home the cat has become wider, but
01:00:41
something is a parameter I have, something else is
01:00:43
not being created right now, but on the account, and here I want it
01:00:45
to I had you here and I’m jumping
01:00:52
by the way left and right control left control
01:00:54
right according to the words and don’t use the mouse
01:00:56
again y from the same spirit and in
01:01:01
fact in a good way so that the ball does not fly out of
01:01:04
bounds you need to create p at the beginning and
01:01:06
do from r now it minus this
01:01:10
same r and the same thing with
01:01:13
take when starting from r to the height minus
01:01:15
equals so that it
01:01:17
more or less fits in my hand, let’s have a ball, what is it,
01:01:21
why is it so bad because my
01:01:25
canvas is not packed, this one the gene of you
01:01:29
for my whole family has not relaxed what’s his name
01:01:32
incra you know yes the binding how’s it nsv
01:01:39
and to the north south west east
01:01:44
let’s do it again
01:01:54
singer and there it’s like that there it’s like that you
01:01:58
can listen to him I honestly don’t remember how to
01:02:00
do it but n .V.
01:02:05
and how can I stretch it there is another
01:02:07
way there is to stretch it fit like x y
01:02:17
phil or feed me map fit what’s the matter
01:02:24
again bed in car and w no in capital
01:02:28
letters phil good reality and phil now
01:02:34
I’m doing x y small or large bau
01:02:42
bau will fit in
01:02:43
written points all Ingush now he
01:02:49
finally what’s the problem he now
01:02:55
started there is no error, well then because.
01:03:07
buff should be thank you,
01:03:14
forgive me, please
01:03:20
do it anyway, it doesn’t stretch it, to be
01:03:23
honest, it doesn’t stretch it normally,
01:03:28
in short, don’t care, let’s shorten our
01:03:31
how to say the narrative, I’ll reduce
01:03:34
the size to about the size of the canvas, and for
01:03:37
us this generation will
01:03:38
always happen here, and in fact, it will take hours
01:03:40
to process the click I don’t have any yet, I want
01:03:42
to say that I have now, first of all, and
01:03:48
all the parameters are global, sorry, I didn’t
01:03:51
get around to doing this, it’s object-
01:03:53
oriented at the pores, we’re running out
01:03:54
of canvas to converge already,
01:03:56
yes, but if I even do it now, well, in the
01:04:00
same read clip or somewhere else, I’ll launch it now
01:04:03
I will still write such a tag in
01:04:06
which I will make a root. author in which
01:04:12
I will call
01:04:14
events I correspond to the same
01:04:17
type yes with there 5 50 microseconds conditionally
01:04:22
day I remember the truth the parameters in which on the
01:04:23
contrary accordingly what can I
01:04:27
do I now set once for 20
01:04:31
times per second in fact yes something will
01:04:33
happen print samsung here and
01:04:38
I have this type, the main thing now is to
01:04:40
start, after everything I’m
01:04:43
here once and I’ll run one layout,
01:04:45
I’ll make a disabled syntax where I forgot:
01:04:48
install thank you interpreter and now I have
01:04:53
samsung printed 20 times per second, why do I need this I need it, so
01:04:56
now I can take it and
01:04:59
modify it if I get to x and y
01:05:05
and p, well, maybe I don’t even need it now,
01:05:09
then I can now take it and
01:05:13
move the ball,
01:05:14
but while it’s here it’s
01:05:18
bad, what will I do
01:05:20
x plus equals 1 y plus equals 1 and this is how
01:05:25
I do it until I apologize, the variables
01:05:27
change until and the canvas doesn’t move
01:05:30
well, what else should I say ska
01:05:33
canvas, what’s the move, yes it means the move, what was it
01:05:40
called ball aide means and
01:05:45
you need to tell him the steps actually he
01:05:47
needs to do a dext there y there something like this
01:05:50
done I don’t show off now, I’ll
01:05:53
just do it like that and my ball
01:05:55
flew I really like what I just
01:05:59
wrote I assumed that I would
01:06:01
write faster and that we’ve reduced the match a little more
01:06:03
we’ll have time to push this thing to class
01:06:05
because now the movement itself is
01:06:09
at least killed, look at it, swear at
01:06:12
everything that is happening with me and the
01:06:15
initialization of my this very
01:06:18
initialization of my new ball and its
01:06:22
movement and processing of the click event on
01:06:26
this ball, this is all now
01:06:29
scattered in different places of the program who is
01:06:31
responsible responsibility for the fact that the
01:06:33
ball is clicked, is not attached, is destroyed by him
01:06:35
or does he still have a house,
01:06:37
maybe he should have health and the ball
01:06:38
gradually changes its color
01:06:40
to red and only then it will burst, and
01:06:42
where is the actual effect of bursting, but for
01:06:44
example, I want it to burst on me
01:06:45
some kind of blot was beautifully drawn
01:06:47
before it was finally
01:06:48
destroyed where the calculation of experience is,
01:06:51
we should all be
01:06:54
encapsulated somewhere they are scattered in different
01:06:56
places of the program I want to
01:06:58
modernize I want to change the
01:07:00
processing of all this and I need to
01:07:03
climb throughout the entire program to look for these
01:07:05
pieces, but there should be a place where
01:07:08
everything is clear how it lies, let's next time
01:07:10
we do this thing beautifully shaped thank you
01:07:12
[applause]

Description:

Практика: http://cs.mipt.ru/python Telegram-группа: https://t.me/tkhirianov_python_2019 Программа курса: https://github.com/tkhirianov/lections_2019/tree/master/semestr_1 Спонсировать: https://www.patreon.com/tkhirianov или https://www.paypal.com/paypalme/tkhirianov или 63900240 9020000598 (карта СБ).

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "Практика программирования на Python 3, лекция №7" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "Практика программирования на Python 3, лекция №7" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "Практика программирования на Python 3, лекция №7" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "Практика программирования на Python 3, лекция №7" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "Практика программирования на Python 3, лекция №7"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "Практика программирования на Python 3, лекция №7"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.