CS61A Lecture3 Note
本次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的更多相关文章
- Linear Algebra lecture3 note
Matrix multiplication(4 ways!) Inverse of A Gauss-Jordan / find inverse of A Matrix multiplication ...
- [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 ...
- 三星Note 7停产,原来是吃了流程的亏
三星Note 7发售两个月即成为全球噩梦,从首炸到传言停产仅仅47天.所谓"屋漏偏逢连天雨",相比华为.小米等品牌对其全球市场的挤压.侵蚀,Galaxy Note 7爆炸事件这场连 ...
- 《Note --- Unreal --- MemPro (CONTINUE... ...)》
Mem pro 是一个主要集成内存泄露检测的工具,其具有自身的源码和GUI,在GUI中利用"Launch" button进行加载自己待检测的application,目前支持的平台为 ...
- 《Note --- Unreal 4 --- Sample analyze --- StrategyGame(continue...)》
---------------------------------------------------------------------------------------------------- ...
- [LeetCode] Ransom Note 赎金条
Given an arbitrary ransom note string and another string containing letters from all th ...
- 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 ...
- 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 ...
- Beginning Scala study note(7) Trait
A trait provides code reusability in Scala by encapsulating method and state and then offing possibi ...
随机推荐
- java基础 -- 经典排序
---- 冒泡排序 方法: 1.每次比较相邻的两个数 2. 小的交换在前面 3.每轮结束后最大的数交换到最后 代码实现: /* * 冒泡排序 * */ public class SortNum { ...
- WPF中textBlock 变色功能
<Window.Resources> <Storyboard x:Key="OnLoaded" RepeatBehavior="Forever" ...
- 4-21 嵌套选择器 、块级元素和内联元素、光标、布局-overflow
1.嵌套选择器 p{ }: 为所有 p 元素指定一个样式.(默认,,也就是说可以被改变样式) .marked{ }: 为所有 class="marked" 的元素指定一个样式. . ...
- Tomcat start.bat闪退:JRE_HOME环境变量配置不对
最近在配置Tomcat上遇到startup.bat启动闪退,在网上找了很多方法,都没解决.后来在网上找到两种问题,更改了两次,解决了.现将我遇到的问题分享,希望对遇到同样问题有帮助. 1.很多初学者对 ...
- mongodb cxx driver学习
mongodb 增删改查 insert 向集合中增加一个文档 remove 删除文档 update 更新(修改)某些文档 文档替换 文档修改器,只修改文档某个部分 find 返回集合中所有文档 fin ...
- 如何将一段文本编译成C#内存程序的过程
string code = null; // 1. 生成要编译的代码.(示例为了简单直接从程序集内的资源中读取) Stream stram = typeof(CodeDOM).Assembly .Ge ...
- SpringMVC 使用PUT请求遇到的问题小结
最近在使用REST风格的URL进行CURD操作的学习过程中 发现使用PUT请求时候提交表单进行修改操作 报错:Request method 'PUT' not supported 在网上查找资料发现是 ...
- 2018.09.29 Lua
转自:https://zybuluo.com/lisaisacat/note/636399 谢谢 Lua 基础简明教程 脚本开发 目录 Lua 基础简明教程 目录 注释 Lua 编程 语句块 赋 ...
- [入门]在Mac OS X下使用和配置Android Studio
Android Studio可谓是安卓开发的XCode,流畅的速度+顺眼的UI足以秒杀Eclipse.在Mac OS X可以通过如下的途径获得Android Studio 最新版本的Android ...
- TensorFlow升级到1.13
win10下: 安装后import tensorflow出错:tensorflow/python/lib/core/bfloat16.cc:675] Check failed: PyBfloat16_ ...