本次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. js给页面添加回车监测事件,实现回车登录功能

    document.body.addEventListener('keyup', function (e) { ') { $("#btn_login").click(); } }) ...

  2. SSM商城开发学习

    功能模块:前端:门户.商品搜索.商品展示.购物车.注册&登录 后端:商品管理.订单管理.cms 上线,bug,维护,停到上线,维护,打包,上线 某一个模块出现bug,停到这个模块 tomcat ...

  3. project3 blockchain

    [概念] 做服务的时候main里面不能单独有东西,都得包起来. Identifier expected是因为没有main函数 雾草,task3还要加proxy, add再干别的.难受!妈的,什么代理模 ...

  4. 关于vue中tamplate和DOM节点浅谈

    前言:在开发前段页面使用vue时,我们能经常看到template标签.这里粗略讲下自己对vue中template理解和使用. 1. 先了解vue vue.js是一个轻巧.高性能.壳组件画的MVVM库. ...

  5. mumu模拟机安装证书

    1. 先设置锁屏密码 2. 证书.crt才可以直接安装..der和.cer的都不可以.

  6. windows安装MongoDB副本集,通过Java程序实现数据的插入与查询

    我本地的环境 MongoDB 4.0 jdk 1.7.x 安装参考主要博客 https://blog.csdn.net/wanght89/article/details/77677271#commen ...

  7. 使用Fiddle对夜神模拟器进行抓包的设置

    注意: 设置完后, 不开启 Fiddle 的话,模拟器就不能上网了.  可以通过再把网络配置 改回去 就可以恢复网络正常访问了 一.配置Fiddle参数设置 1.Tools->Options 2 ...

  8. MySql 游标定义时使用临时表

    参考:Re: Temp Table in Select of a Cursor 方法一: delimiter $$ create procedure test_temp() begin drop te ...

  9. leetcode4:两个排序数组的中位数

    给定两个大小为 m 和 n 的有序数组 nums1 和 nums2 . 请找出这两个有序数组的中位数.要求算法的时间复杂度为 O(log (m+n)) . 1.我的思路:直接用sort,时间复杂度应如 ...

  10. Libsvm Java

    在java环境下用Libsvm包解决一个多分类问题. 1.将训练数据和测试数据按照libsvm的数据格式存放 可以写程序直接构造,libsvm的数据格式如下 Label 1:value 2:value ...