[PyKDE] a few issues

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Mon Aug 8 19:14:53 BST 2005


On Mon, 8 Aug 2005 18:50:27 +0100
Phil Thompson <phil at riverbankcomputing.co.uk> wrote:

> On Friday 29 July 2005 6:16 am, Gerard Vermeulen wrote:
> > (1) (public) member data of class Foo does not show up in dir(Foo).
> >     This trips up tools like PyChecker and the standard library module
> >     inspect.py
> 
> Works for me. Do you have an example .sip file in case I'm misunderstanding 
> what you mean?
> 
Sorry, I was not clear enough: public data shows up in instances but not
in classes:

%Module v 0

class C
{
%TypeHeaderCode
class C
{
public:
    void alwaysVisible() {};
    int hiddenInClassButVisibleInInstance;
};
%End

public:
    void alwaysVisible();
    int hiddenInClassButVisibleInInstance;
};


And now:

[packer at titan data]$ python
Python 2.4 (#2, Feb 12 2005, 00:29:46)
[GCC 3.4.3 (Mandrakelinux 10.2 3.4.3-3mdk)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from v import *
>>> dir(C)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'alwaysVisible']
>>> c = C()
>>> dir(c)
['__class__', '__delattr__', '__doc__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__', '__weakref__', 'alwaysVisible', 'hiddenInClassButVisibleInInstance']

Gerard




More information about the PyQt mailing list