新风格的课程 [英] new style class
问题描述
班级考试(对象):
def执行(自我,v):
返回v
def escape(v):
return v
如果__name__ ==''__ main__'':
gert = Test ()
打印gert.m1(''1'')
打印Test.m2(''''')
为什么这个新的样式类在python 2.5.1中不起作用?
class Test(object):
def execute(self,v):
return v
def escape(v):
return v
if __name__ == ''__main__'':
gert = Test()
print gert.m1(''1'')
print Test.m2(''2'')
Why doesn''t this new style class work in python 2.5.1 ?
推荐答案
gert写道:
gert wrote:
class Test(object):
def执行(self,v):
return v
def escape(v):
返回v
如果__name__ ==''__ main __''
:
gert =测试()
打印gert.m1(''1'')
打印Test.m2(''''')
为什么这个新的样式类在python 2.5.1中不起作用?
class Test(object):
def execute(self,v):
return v
def escape(v):
return v
if __name__ == ''__main__'':
gert = Test()
print gert.m1(''1'')
print Test.m2(''2'')
Why doesn''t this new style class work in python 2.5.1 ?
为什么要这样?
why should it ?
11月2日,12:2晚上7点,Boris Borcic< bbor ... @ gmail.comwrote:
On Nov 2, 12:27 pm, Boris Borcic <bbor...@gmail.comwrote:
gert写道:
gert wrote:
class Test(object):
class Test(object):
def execute(self,v):
return v
def execute(self,v):
return v
def escape(v):
return v
def escape(v):
return v
如果__name__ ==''__ main__'':
gert = Test()
print gert.m1(''1'')
print Test.m2(''''')
if __name__ == ''__main__'':
gert = Test()
print gert.m1(''1'')
print Test.m2(''2'')
为什么这个新的样式类在python 2.5.1中不起作用?
Why doesn''t this new style class work in python 2.5.1 ?
为什么要这样?
why should it ?
我不知道我认为它得到了2.2的支持吗?
I don''t know I thought it was supported from 2.2?
On 11月2日下午12:31,gert< gert.cuyk ... @ gmail.comwrote:
On Nov 2, 12:31 pm, gert <gert.cuyk...@gmail.comwrote:
11月2日下午12:27,Boris Borcic< ; bbor ... @ gmail.comwrote:
On Nov 2, 12:27 pm, Boris Borcic <bbor...@gmail.comwrote:
gert写道:
gert wrote:
class Test(object) :
class Test(object):
def执行(self,v):
返回v
def execute(self,v):
return v
def escape(v):
return v
def escape(v):
return v
if __name__ ==''__ main__'':
gert =测试()
打印gert.m1(''1'')
打印Test.m 2(''2'')
if __name__ == ''__main__'':
gert = Test()
print gert.m1(''1'')
print Test.m2(''2'')
为什么这个新款式不起作用在python 2.5.1?
Why doesn''t this new style class work in python 2.5.1 ?
为什么要这样?
why should it ?
我不知道我认为它是2.2支持的?
I don''t know I thought it was supported from 2.2?
oops代码是这样但是不起作用
class Test(对象):
def m1(self,v):
返回v
def m2(v):
返回v
如果__name__ ==''__ main__'':
gert = Test()
print gert。 m1(''1'')
打印Test.m2(''''')
oops the code is like this but doesn''t work
class Test(object):
def m1(self,v):
return v
def m2(v):
return v
if __name__ == ''__main__'':
gert = Test()
print gert.m1(''1'')
print Test.m2(''2'')
这篇关于新风格的课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!