静态python类? [英] static python classes ?

查看:75
本文介绍了静态python类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我是python的新手,我似乎无法在文档中找到如何创建

的python相当于大多数OOP语言中所谓的静态

类,你能给我一个提示吗?

Hi,

I''m new to python, and I can''t seem to find in the docs how to create
the python equivalent of what''s called in most OOP languages "static
classes", can you give me a hint ?

推荐答案

6月19日晚上10点,Tom Gur< gur .... @ gmail.comwrote:
On Jun 19, 10:00 pm, Tom Gur <gur....@gmail.comwrote:




我是python的新手,我似乎无法在文档中找到如何创建

python相当于所谓的在大多数OOP语言中,静态

类,你能给我一个提示吗?
Hi,

I''m new to python, and I can''t seem to find in the docs how to create
the python equivalent of what''s called in most OOP languages "static
classes", can you give me a hint ?



http://docs.python.org/lib/built-in-funcs.html


示例:

class C:

@staticmethod

def f(arg1,arg2,...):...


-

Gerald Kaszuba
http://geraldkaszuba.com

Look for @staticmethod in http://docs.python.org/lib/built-in-funcs.html

Example:
class C:
@staticmethod
def f(arg1, arg2, ...): ...

--
Gerald Kaszuba
http://geraldkaszuba.com


python相当于在大多数OOP语言中调用的内容static
the python equivalent of what''s called in most OOP languages "static

classes",你能给我一个提示吗?
classes", can you give me a hint ?



寻找@staticmethod inhttp://docs.python.org/lib/built-in-funcs.html


Look for @staticmethod inhttp://docs.python.org/lib/built-in-funcs.html



Woops ...我误读了......


-

Gerald Kaszuba
http://geraldkaszuba.com

Woops... I misread...

--
Gerald Kaszuba
http://geraldkaszuba.com


2007年2月-06-19 at 12:00 +0000,Tom Gur写道:
On Tue, 2007-06-19 at 12:00 +0000, Tom Gur wrote:




我是新的到python,我似乎无法在文档中找到如何创建

python相当于大多数OOP语言中所谓的静态

班级,你能给我一个提示吗?
Hi,

I''m new to python, and I can''t seem to find in the docs how to create
the python equivalent of what''s called in most OOP languages "static
classes", can you give me a hint ?



如果我不得不猜测,显然我必须这样做,因为你没有告诉

我们你认为是什么? ;静态类是的,我会说你想要一个

所有方法都是静态的课程。在Python中,制作这样的
是没有意义的。只需制作一个定义所需功能的模块。


如果这没有帮助,请向我们解释你实际上在想什么

实现。


-

Carsten Haese
http://informixdb.sourceforge.net


这篇关于静态python类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆