我如何获得类型方法? [英] How do I get type methods?

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

问题描述

您好!


如果我这样做


导入uno

localContext = uno.getComponentContext()


然后localContext的类型为< type''pyuno''>

我猜它是PyUNO扩展提供的新类型。

localContext .__ class__是无

有没有办法列出所有新类型的方法,通过Python C

API或通过解释器(除了dir之外) (localContext))?

我想要的是在教程中调用localContext的方法

例子:


x = MyClass()

MyClass.f(x)


谢谢,

Dmitri

Hello!

If I do

import uno
localContext=uno.getComponentContext()

then localContext is of type <type ''pyuno''>
I guess it''s a new type provided by PyUNO extension.
localContext.__class__ is None
Is there any way to list all methods of that new type, via Python C
API or through interpreter (other then dir(localContext) )?
What I want is to call localContext''s methods like in the tutorial
example:

x=MyClass()
MyClass.f(x)

Thank you,
Dmitri

推荐答案

ya ******** @ yahoo .com schrieb:
ya********@yahoo.com schrieb:

你好!


如果我这样做


import uno

localContext = uno.getComponentContext()


然后localContext属于& LT;输入''pyuno''>

我想这是PyUNO扩展提供的新类型。

localContext .__ class__是无

有没有办法列出这种新类型的所有方法,通过Python C

API或通过解释器(除了dir(localContext)之外)?
Hello!

If I do

import uno
localContext=uno.getComponentContext()

then localContext is of type <type ''pyuno''>
I guess it''s a new type provided by PyUNO extension.
localContext.__class__ is None
Is there any way to list all methods of that new type, via Python C
API or through interpreter (other then dir(localContext) )?



'dir()`有什么问题?

What''s wrong about `dir()`?


我想要的是打电话localContext'的方法就像在教程中

例子:


x = MyClass()

MyClass.f(x)
What I want is to call localContext''s methods like in the tutorial
example:

x=MyClass()
MyClass.f(x)



我更喜欢::


x = MyClass()

xf()

I''d prefer::

x = MyClass()
x.f()


>

谢谢,

Dmitri
>
Thank you,
Dmitri


5月4日凌晨3:21,Stargaming< stargam ... @ gmail.comwrote:
On May 4, 3:21 am, Stargaming <stargam...@gmail.comwrote:

什么是错的? dir()`?

x = MyClass()

xf()
What''s wrong about `dir()`?
x = MyClass()
x.f()



我想把指针指向Python在非Python应用程序中运行。

''dir()''需要一个参数,我希望得到函数指针

之前我有给定的变量类型或类。

这就是为什么''MyClass.f(x)''

I''mn反对''dir(MyClass)'';问题是,我应该得到什么(')''

来获取''pyuno''类型实例的方法?


真诚的你,

Dmitri

I want to cashe pointers to Python functions in a non-Python app.
''dir()'' requires an argument, and I want to get function pointers
before I have any variable of given type or class.
That''s why ''MyClass.f(x)''
I''m not against ''dir(MyClass)''; the question is, what should I ''dir()''
to get methods of ''pyuno'' type instance?

Sincerely yours,
Dmitri


En Fri,2007年5月4日01:34:20 -0300,< ya ****** **@yahoo.comescribió:
En Fri, 04 May 2007 01:34:20 -0300, <ya********@yahoo.comescribió:

我不反对''dir(MyClass)'';问题是,我应该用什么来获取''pyuno''类型实例的方法?
I''m not against ''dir(MyClass)''; the question is, what should I ''dir()''
to get methods of ''pyuno'' type instance?



通常实例没有自己的方法,他们从

类中获取它们。所以你实际上需要dir(MyClass)。

注意dir()可能不会显示所有可用的方法。


-

Gabriel Genellina

Usually instances don''t have its own methods, they get them from the
class. So you actually need dir(MyClass).
Note that dir() might not show all available methods.

--
Gabriel Genellina


这篇关于我如何获得类型方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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