To be a better coder
发布时间:2019-03-19 13:59:35
[root@localhost /]# [root@localhost /]# [root@localhost /]# cat z.py #!/bin/pythonfrom functools import update_wrapper, wrapsdef a(b,c=3,d=[]): '''aaaaaaaaaaaaaa''' return a*2#print a.__name__#print a.__defaults__#print a.__doc__.........【阅读全文】
发布时间:2019-03-18 15:45:36
修饰器,增加缓存的意义[root@localhost /]# [root@localhost /]# cat zlg.py #!/bin/pythondef a(n,cache=None): if cache is None: cache={} if n in cache: return cache[n] .........【阅读全文】
发布时间:2019-03-18 14:48:31
转自:https://blog.csdn.net/pro_leo/article/details/41786397(有修订)1、Python缓存作用: a、提高执行效率。 b、减少内存负担。2、首先,我们看下面这一段code:>>> num1, num2 = 1, 1 >>> print num1 is num2 True >>> id(num1), id(num2) (3965416, 3965416) >>> num.........【阅读全文】