本次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. atom使用技巧

    文本 批量处理 正则 空格换成换行:Atom替换换行符直接[Ctrl]+[F],然后选择正则,输入\n

  2. SpringBoot集成MongoDB

    前言 之前写了各种nosql数据库的比较,以及相关理论,现在我在本地以springboot+MongoDB框架,探究了具体的运行流程,下面总结一下,分享给大家. 运行前准备 安装并启动MongoDB应 ...

  3. Putty6.0 提示Access denied

    1.如果putty能正常使用,解决方法很简单: 只要在Putty的configuration里面Connection->SSH->Auth->GSSAPI的配置中,去掉默认的Atte ...

  4. 10.Redis分布式集群

    10.Redis分布式集群10.1 数据分布10.1.1 数据分布理论10.1.2 Redis数据分区10.1.3 集群功能限制10.2 搭建集群10.2.1 准备节点10.2.2 节点握手10.2. ...

  5. Connection failed Flowsocketconnector Failed to connect to target addressWindows error10061:由于目标计算机积极拒绝,无法连接

    使用bitbise时报上面错误   : 解决方法 :卸载软件并删除相关的文件 (包含bitvise 及注册表中的文件)重新安装后能连接

  6. Lonsdor K518ISE programs 2005 Ford Focus key in two minutes

    A quick demonstration of Lonsdor K518ISE programming key for 2005 Ford Focus in two minutes. And for ...

  7. rabbit基本原理 转

    https://www.cnblogs.com/jun-ma/p/4840869.html

  8. SVN与资源库同步后动作的字母意义

    U:表示从服务器收到文件更新了G:表示本地文件以及服务器文件都以更新,而且成功的合并了A:表示有文件或者目录添加到工作目录R:表示文件或者目录被替换了C:表示文件的本地修改和服务器修改发生冲突

  9. MySQL忘记密码怎么修改密码

    MySQL的 root 帐号密码默认为空,经常都有修改密码后忘记密码的事.如果忘记了root 帐号密码,那该怎么修改密码呢?这里有一个可行的方法,就是在MySQL安全模式下(跳过权限检查)修改密码的方 ...

  10. 【机器学习】支持向量机(SVM)的优化算法——序列最小优化算法(SMO)概述

    SMO算法是一一种启发式算法,它的基本思路是如果所有变量的解的条件都满足最优化问题的KKT条件,那么这个最优化问题的解就得到了.因为KKT条件是该优化问题的充分必要条件. 整个SMO算法包括两个部分: ...