This is what's actually going to create the instance, instantiate it, create what the set of variable values are for it.
这个声明在你,创建一个实例的时候,实例化这个实例,然后给这个实例。
Right add to it in a second, but the idea is class is going to be a template for creating instances.
对象的实例的模板,现在,这真是一个很蠢的模板,我马上会去完善它,但是首先我应该先建立起它来。
And I have actually seen evidence over the years, mercifully, just a small amount of evidence, but there are, in a group like this, always a few students who come in with a really strong background in high school.
这几年我已经见到了实例,令人感激的是,只有小部分人,但在这,像这样的一个小组,总有一些来到我们这的学生,在高中打下了良好的基础。
And then I'll give you some examples of some of the specific topics that would be covering.
接下来我会给出一些,我们会涉及话题的具体实例
Earlier theories-- it's wonderful to have scientific theories that you can use to handle these problems, which you cannot demonstrate any fact for whatsoever.
更早些的理论...,幸好我们还有些科学理论,可以用来处理这些问题,这些没有实例,可以证明的问题
So, this is real people who were involved in these tests.
那么,这是人们参与这些试验的实例
We attach a probability to an event. OK?
我们举个实例吧,好吗
That's an example of "growing-tip" statistics research.
这就是个成长尖端统计学的研究实例。
They were laying all over the place.
而且全世界都充斥着这种实例
Given the abstraction, the notion of a point as an instance with some values, I can now start building segments.
真的很有帮助,基于这个抽象,点的概念也就是一个,有一些值的实例。
And in fact if I go off and run this, OK, what I was printing here was s 1 dot length, and that's -- What is it doing?
他们就是一些有结构的实例,实际上如果我去运行下这个,好,我这里输入的?
Now I have the ability to say, I've got a new class, I can create instances of a line segment, and it's elements are themselves instances of points. OK?
这就是我们要讲模块化的地方了,现在我可以说,我创建了一个新类,我可以创建线段的实例了,这些实例的元素?
Because I could've built that in, it says if you change the value of this thing, by the way you need to change recompute those other values in order to make this hold up.
我想要大家通过定义好的方法,来改变实例的值了,因为我可以把这个功能,内置到方法里面去,它的意思就是如果,你改变一个值。
So, this is an example movie but this is what babies would see.
你们看到的是一段实例影片,不过婴儿们就是观看这样的影片
Or another way of thinking about it, is remember I said when I call that class definition it creates an instance, that's a pointer to some spot in memory that's got some local information around it.
也就是一个指向,内存中某处的指针,这个地方存有一些,这个实例的信息,浅意义的相等也就是说,看看这两个东西是不是。
And then there were a couple of other ones in there that I hadn't actually dealt with.
这些一同被称作实例的属性,实际上这里还有一些东西,我没有处理到。
They are instances of a class, and associated with that class is a set of methods.
它们是同一个类的实例,与这个类相关联的是一个方法集,因此例如,我可以说。
Again, it's got an initializer, or an instance creator, right there.
跟上次一样,这里有个初始器,或者说是个实例创造器,就在这里。
And then what might I want to do with the segment?
是点的实例,对不对?,然后我可能想?
Development of an artificial heart, again another example of Biomedical Engineering, is something that people have been trying to accomplish for decades now, and this is the closest that we've come and there are many advantages of this particular artificial heart.
人造心脏技术的发展,是生物医学工程的另一个例子,科学家们,试图在这二十年中去改进它,而这是最接近成功的一个实例,这枚人造心脏有很多优点
So, here's just one more case where Yale helped to straighten out the but you notice it wasn't done by a Yale faculty member, we engage in confusing the world, but our alumni do a much better job and that's what happened here.
因此 这只是耶鲁帮助人们,正确看待世界的又一个实例罢了,但要注意,这并不是耶鲁的教员做的,我们仍然在一个困扰的世界奔波,但我们的毕业生们做得更好,就是这样
But there's actually hidden in there an important element, and that is, when I create an instance, I have to be able to get access to the things that characterize that instance.
也就是,当我创建了一个实例,我应该能够获得那些特性化,这个实例的东西,我的意思不是说它们是想法,或者情绪之类的。
I won't say that they're thoughts and emotions or things, but what characterizes an instance here, it's the internal parameters that specify what is going on.
但是这里特性化,这个实例的东西是,是内在的详细说明,要做什么的参数,因此实际上在一个。
Right that's a specific name, and what it basically says is, when I call the class instance.
好这是个特定的应用,它的意思也就是,让我调用一个类的实例。
Is is essentially saying, given 2 things, do they point to exactly the same referent?
或者换种思考的方式,大家记得我说过当我们,调用类的定义声明的时候,它会创建一个实例?
Right now, I still have the problem that those classes, those instances of classes, are exposed.
就是这些类,这些类的实例,都是暴露的,我这么说什么意思呢?
I think of data hiding as basically saying, one can only access instance values, or, we'll call them that, instance values through defined methods.
一个人仅仅可以访问实例变量,或者,我们可以这么来说,通过定义好的方法,来访问实例的变量。
So in fact what happens inside of an object-oriented system, and particularly in init Python's object-oriented system, is the following.
面向对象系统的内部,尤其是在Python的面向,对象系统的内部的过程,就是如下的,当我们调用,它会去创建一个实例。
When I call the class definition, that is I call c point, I'm going to call it with a specific set of arguments.
来创建实例的时候,也就是调用c,point的时候,我会以一个特定的参数集来调用它,然后将要发生的就是init将会被应用。
Don't go in and change the values of things by using the direct access.
也就是别这么做,别直接去访问,并改变实例中的数值。
应用推荐