What I'm doing, by the way, here is I'm simply typing in expressions to that interpreter.
顺路说一下,我正在做的就是给计算器传入,一个表达式。
And if we type directly into the interpreter, it essentially does an eval and a print.
如果我们直接输入到解释器里面,它本质上会运算然后返回结果。
So the interpreter is simply operating directly on your code at run time.
因此解释器在运行程序的时候,会直接的对你的代码进行操作。
What that basically says is the following: in an interpreted language, you take what's called the source code, the thing you write, it may go through a simple checker but it basically goes to the interpreter, that thing inside the machine that's going to control the flow of going through each one of the instructions, and give you an output.
也就说,如果是解释语言的话:,你要写一些叫做,源码的东西,你写的东西会经过一个简单的过滤器,然后解释器会处理你的源码,解释器会产生一个,逐条读取你的源码的,控制流,然后返回一个输出结果。
The interpreter is going to get a value for it.
处理器会对表达式运算得到一个结果值。
This is what the interpreter sees. All right?
这时解释器看到的,对吗?
Which is, and we're going to do some examples of this, initially we just typed in expressions Python into the interpreter; that is,directly into Python And as I suggested last time, the interpreter is actually a program inside of the machine that is basically following the rules we're describing here to deduce the value and print it up.
也就是,我们将会对这一点讲解一些例子,一开始我们只是简单的把表达式输入,到解释器里面去,也就是直接传给,我上次跟大家讲过,解释器实际上是,机器内置的,按照我们描述的规则,来推算出结果值并把值显示出来的一个东西。
When I'm talking to the interpreter, when I'm typing things in as I just did, to that Python environment, I'm getting what I'm going to call global bindings.
当我和解释器对话时,我会向我说的一样进行输入,输入到Python语言环境中,我会设置全局变量。
Think of this as the, as the world of the interpreter, in that I've got things 3 like x bound to the value of 3.
想像一下这里就是,编译器里的世界,在这里我给x赋值为。
And in Python the expression is, operand, operator, operand, when we're doing simple expressions like this, and if I give it to the interpreter, it gives me back exactly what you'd expect, which is that value. OK?
在Python中表达式就是,运算对象,操作符,运算对象,当我们处理这样的简单表达式的时候,我把表达式传给处理器,处理器给我返回了我想要的结果,对不对?
应用推荐