![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
SchopenhauerZhang
/*
以往: 十字路口 瑟瑟发抖
而如今:吾常身不离鞍,髀肉皆消。今不复骑,髀里肉生。
*/
我到了该读王小波的作品的阶段了
展开
-
Currying and AntiCurrying
博文编程环境mac 2018OS: 10.15.5Python3.8vscode 1.48.0介绍柯里化是把接受多个参数的函数变换成接受一个单一参数(最初函数的第一个参数)的函数,并且返回接受余下的参数而且返回结果的新函数的技术。–摘自wiki。简单介绍就是,当函数需要传入多个参数,通过将其中部分参数赋值为固定值,实现只需传入一个参数就能获取到结果的(函数)技术。反柯里化(AntiCurrying)则是将柯里化的函数还原。请看Python3实现代码Python 实现以下列举了在Py.原创 2020-08-17 20:47:56 · 161 阅读 · 0 评论 -
PDB使用
调试Python程序的小工具首先众所周知调试C程序的高效率工具–GDB有了Python版本:pdb。安装pip install pdb调试程序样例:# test.pyimport signalimport timedef get(d): print(d) print(d+1) time.sleep(60) return Noneget(1)...原创 2020-04-23 19:49:13 · 541 阅读 · 0 评论 -
Python环境安装
下载pythonhttps://www.python.org/downloads/mac-osx/下载后安装安装ipython:http://ipython.org/install.htmlsudo easy_install pippip install ipython原创 2019-04-22 17:49:38 · 238 阅读 · 0 评论 -
没有else的if是否更为高效?
在python中,探讨if else和if 的效率问题。比如下面2个python 自定义函数def get_sum(a,b): if a > b: return a+b else: return a+bdef get_sum_no_else(a,b): if a > b : return a+b return a+b通过引入 dis模块,进行字节码编译,...原创 2019-06-14 09:48:57 · 678 阅读 · 0 评论 -
python 之unittest module
python的单元测试module:unittest测试代码:class tree(): ...: def get(self,str_tree): ...: print('get',str_tree,'\n') ...: def post(self,str_tree): ...: print('post',str_...原创 2019-07-15 16:06:20 · 288 阅读 · 0 评论