本次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. CentOS7 安装并配置MySQL8.0

    安装环境 linux版本:CentOS 7.6 x64 Mysql:8.0 在CentOS中默认安装有MariaDB,但是我们需要的是MySQL,安装MySQL可以覆盖MariaDB. MariaDB ...

  2. Kubernetes节点维护

    1.设置节点为不可调度 kubectl cordon $NODENAME 2.使用kubectl drain优雅的结束节点上的所有 pod 并同时标记节点为不可调度 kubectl drain $NO ...

  3. 通过url获取bitmap

    //通过Uri获取BitMap public static Bitmap getBitmapFromUri(Uri uri,Context context) { Bitmap bitmap = nul ...

  4. vue--1.环境搭建及创建项目

    转自https://blog.csdn.net/junshangshui/article/details/80376489 一.环境搭建及创建项目 1.安装node.js,webpack 2.安装vu ...

  5. Swoole 心跳检测

    Swoole的心跳检测特别简单,只需要配置 heartbeat_check_interval,heartbeat_idle_time就可以了. heartbeat_check_interval:表示服 ...

  6. Docker 日志都在哪里?怎么收集?

    https://www.cnblogs.com/YatHo/p/7866029.html 日志分两类,一类是 Docker 引擎日志:另一类是 容器日志. Docker 引擎日志 Docker 引擎日 ...

  7. windows2012 raid架构 忘记系统管理员密码的解决方法

    1. http://bbs.51cto.com/thread-939710-1.html 2. https://wenku.baidu.com/view/115783cd0b4e767f5acfcef ...

  8. gperftools对程序进行分析

    gperftools是google出品的一个性能分析工具,相关介绍可见:https://github.com/gperftools/gperftools/wikigperftools性能分析通过抽样方 ...

  9. javaMail的使用以及trying to connect to host "1xxx@163.com", port 25, isSSL false异常

    最近项目用到邮件系统,开始了解javaMail...话不多说先上代码: pom依赖: <!--    邮件  https://mvnrepository.com/artifact/javax.m ...

  10. Linux无法正常连接服务器,无法连接上 127.0.0.1:8989 (127.0.0.1)。 - connect (111: 拒绝连接)

    最近修改了下电脑的hosts文件,电脑就突然不能连接下载更新的服务器了,但是浏览器还能正常上网,这让我很是难受啊!!! 错误现象如下: 错误:1 http://archive.ubuntukylin. ...