本次lec主讲控制流

本文档只列一些py控制流与C不同的地方

 print的功能不同 可以print出来None这种东西

重点讲了函数运行机制,我的理解是这样的,在调用函数之前,def会产生一个global frame。里面包含square和mul。每调用一次函数,就会产生一个新的frame,但是新的frame里执行的mul每次都要到global frame里去找并执行。

doctest 很好的测试程序的方法,也是ok的运算机制。

另一py特性:default value当调用dive_exact(2018)时,d会自动取10

又一个与C不同的地方:

If and and or do not short-circuit, they just return the last value. Keep in mind that and and or don't always return booleans when using values other than True and False.

CS61A Lecture3 Note的更多相关文章

  1. Linear Algebra lecture3 note

    Matrix multiplication(4 ways!) Inverse of A Gauss-Jordan / find inverse of A   Matrix multiplication ...

  2. [CS61A] Lecture 4. Higher-Order Functions & Project 1: The Game of Hog

    [CS61A] Lecture 4. Higher-Order Functions & Project 1: The Game of Hog Lecture Lecture 4. Higher ...

  3. 三星Note 7停产,原来是吃了流程的亏

    三星Note 7发售两个月即成为全球噩梦,从首炸到传言停产仅仅47天.所谓"屋漏偏逢连天雨",相比华为.小米等品牌对其全球市场的挤压.侵蚀,Galaxy Note 7爆炸事件这场连 ...

  4. 《Note --- Unreal --- MemPro (CONTINUE... ...)》

    Mem pro 是一个主要集成内存泄露检测的工具,其具有自身的源码和GUI,在GUI中利用"Launch" button进行加载自己待检测的application,目前支持的平台为 ...

  5. 《Note --- Unreal 4 --- Sample analyze --- StrategyGame(continue...)》

    ---------------------------------------------------------------------------------------------------- ...

  6. [LeetCode] Ransom Note 赎金条

    
Given
 an 
arbitrary
 ransom
 note
 string 
and 
another 
string 
containing 
letters from
 all 
th ...

  7. Beginning Scala study note(9) Scala and Java Interoperability

    1. Translating Java Classes to Scala Classes Example 1: # a class declaration in Java public class B ...

  8. Beginning Scala study note(8) Scala Type System

    1. Unified Type System Scala has a unified type system, enclosed by the type Any at the top of the h ...

  9. Beginning Scala study note(7) Trait

    A trait provides code reusability in Scala by encapsulating method and state and then offing possibi ...

随机推荐

  1. java打包发布程序.jar(Eclipse)

    1.程序运行无错误后,右击项目名称,选择Export 2.next后,选择启动时的运行项目,选择压缩包的存储路径 3.finishi即可. 4.运行 cmd存储路径下>java -jar XXX ...

  2. Intro to Airplane Physics in Unity 3D – 2017 and 2018

    Info:DescriptionHave you ever wanted to build your own Airplane Physics using the Rigidbody componen ...

  3. Mariadb主从复制

    前戏: mysql的基本命令复习 .启动mysql systemctl start mariadb .linux客户端连接自己 mysql -uroot -p -h 127.0.0.1 .远程链接my ...

  4. margin-top / padding-top 的百分比 到底是多少?

    之前,我以为 margin-top/padding-top 如果设置成%,得到的是 基于父对象总高度的百分比. 但是,这种想法是错的.因为在CSS标准里,是基于父对象宽度的百分比. <style ...

  5. Python播放、关闭音乐代码

    1.安装pygame:win + r :打开控制台输入:pip install pygame 2.#导入 import time import pygame 3.设置音乐绝对路径 #音乐路径 file ...

  6. TypeError: unsupported operand type(s) for +: 'float' and 'decimal.Decimal'

    TypeError: unsupported operand type(s) for +: 'float' and 'decimal.Decimal' 浮点型和双精度类型 相加报错 from deci ...

  7. 如何监听Element组件<el-input>标签的回车事件

    一.现象 表单提交时需要处理输入框的回车事件,一般的原生input标签可以用@keyup.enter="onSubmit"(tips:onSubmit为定义的方法) 二.解决 1. ...

  8. vs2010单步调试崩溃

    vs2010在使用单步调试(F10,F11)功能时崩溃,如下图: 困扰了一段时间,度娘,google了很久也没有搜到有价值的解决方案,貌似问题非主流? 原因如下图(禁用即可): 当然这里NET Ref ...

  9. 浏览器中的 JS 和 Node.js 中的 JS

    一个是前端技术,一个是后端技术 浏览器中的 JavaScript ECMAScript  语言基础,如语法.数据类型结构.一些内置对象 BOM(Browser Object Model)  一些操作页 ...

  10. [gazebo-1] process has died [pid 22855, exit code 255,

    [gazebo-1] process has died [pid 22855, exit code 255, cmd /opt/ros/kinetic/lib/gazebo_ros/gzserver ...