上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 37 下一页
摘要: from functools import total_ordering from abc import ABCMeta,abstractmethod @total_ordering class Shape(object): @abstractmethod def area(self): pass def __eq__(self,obj): ... 阅读全文
posted @ 2018-03-16 11:28 howhy 阅读(922) 评论(0) 推荐(0) 编辑
摘要: class telnetClient(object): def __init__(self,addr,port=23): self.addr=addr # @property # def ip(self): # return self.addr # @ip.setter # def ip(self,ipaddr... 阅读全文
posted @ 2018-03-16 10:58 howhy 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 这样从效果就可以看出当再次访问home页面的时候,每次都需要打印before以及after 阅读全文
posted @ 2017-12-18 15:44 howhy 阅读(3159) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2017-12-07 21:05 howhy 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 方差等于平方的均值减去均值的平方” 方差公式: 平均数: (n表示这组数据个数,x1、x2、x3……xn表示这组数据具体数值) 方差公式: 标准差又叫均方差 是方差开平方根 import math math.sqrt(方差) 首先均值,样本方差,样本协方差公式分别为 其中样本方差公式中为什么除的n- 阅读全文
posted @ 2017-12-06 15:11 howhy 阅读(1311) 评论(0) 推荐(0) 编辑
摘要: class doges(object): """类的描述信息""" def __init__(self,name,food): self.name=name self.food=food self.data={}#定义一个类的字典 def __call__(self, *args, **kwargs):#对象后面加括号解执行... 阅读全文
posted @ 2017-11-15 16:07 howhy 阅读(211) 评论(0) 推荐(0) 编辑
摘要: class MyType(type): def __init__(self,*args,**kwargs): print("Mytype __init__",*args,**kwargs) def __call__(self, *args, **kwargs): print("Mytype __ca 阅读全文
posted @ 2017-11-15 14:04 howhy 阅读(397) 评论(0) 推荐(0) 编辑
摘要: 经典类只@property 没有setter 和deleter 1.23 23.4 1.23 23.4 1.23 23.4 23.4 del attr del attr del attr del attr 阅读全文
posted @ 2017-11-14 11:13 howhy 阅读(203) 评论(0) 推荐(0) 编辑
摘要: start start start this is a custom exception this is a custom exception this is a custom exception end end end myexception=MyException('231') print(ha 阅读全文
posted @ 2017-11-13 21:29 howhy 阅读(131) 评论(0) 推荐(0) 编辑
摘要: Django提供一种信号机制。其实就是观察者模式,又叫发布-订阅(Publish/Subscribe) 。当发生一些动作的时候,发出信号,然后监听了这个信号的函数就会执行。 Django内置了一些信号,比如: django.db.models.signals.pre_save 在某个Model保存之 阅读全文
posted @ 2017-11-11 13:58 howhy 阅读(926) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 37 下一页