[PyKDE] QString

Phil Thompson phil at river-bank.demon.co.uk
Sun Apr 2 10:20:19 BST 2000


Pete Ware wrote:
> 
> What's the philosophy behind integrating qt.QString with the rest of
> python.  For example, should one be able to use len()?  Should I
> instead use len (repr (x))?
> 
>         x = qt.QString ('abc')
>         x
>         abc
>         len (x)
>         Traceback (innermost last):
>           File "<stdin>", line 1, in ?
>         AttributeError: __len__

Originally I had intended to map C++ operators to Python special
attributes where sensible. This is how QString generates a __repr__
function. I've since decided that this is too restrictive so I will just
allow any of the __xxx___ attributes to be implemented in handwritten
C++ code. In which case it would make sense to implement __len__ for
QString.

Just haven't got around to it yet.

Phil




More information about the PyQt mailing list