class ComputerFactory: x=None y=True def __new__(cls, *args, **kwargs): if ComputerFactory.x==None: ComputerFactory.x=object.__new__(cls) return ComputerFactory.x def __init__(self): if ComputerFactory.y: print("just one factory") ComputerFactory.y=False def create_computer(self,brand): if brand=="联想": return lenovo() if brand=="华硕": return asus() if brand=="神州": return hasee() print("finish creating") class computer: screen="liquid crystal" keyboard=True def caculate(self): print("Make computer") class lenovo(computer): def caculate(self): print("Lenovo") class asus(computer): def caculate(self): print("ASUS") class hasee(computer): def caculate(self): print("Hasee") C1=ComputerFactory().create_computer("联想") C2=ComputerFactory().create_computer("华硕") C3=ComputerFactory().create_computer("神州") print(C1,C2,C3)
老师,代码末尾几行,如果说写成C1=ComputerFactory.create_computer("联想"),就是类ComputerFactory后没加括号,python报错说需要两个参数 这是为什么?
照着打的为啥报这个错
老师,我有一个问题:在进行RPN对特征图打框的时候,因为我们没有设定正例和负例,那么这个分类器是怎么判断这个框是object或者不是object,然后在Bounding-box regression又是怎么调整框的位置呢(因为没有对照的正例的xywh,这个RPN后的回归损失函数我也想象不出来)。
从哪里可以找到做出来的这个常见异常错误表啊?
老师,我在看完视频后自己写的时候,发现报错为Serializable序列化错误,我用的是MyEclipse2019,而老师用的是Eclipse,我自己实现Serializable接口后没有错误,但是看到老师的实体类并没有实现序列化接口,而且没有报错,是因为什么?是因为软件问题吗?
老师我也是这种情况
老师,这个文件是不用自己动手创建的吗?输入代码自动创建吗?
老师,我想请问为什么文件名为中文名就会报错。
第一句话就报错什么原因
老师,我看不懂这个输出结果。。。。。。。。。。。。。
老师,vscode如何创建包
所以老师还是没懂这个get和post的作用及区别??????????????????????????
style中type="text/css"什么意思,怎么用
为什么每次运行列表的id一直在变,是没有缓存吗?
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637