'class' named tuple

2012-01-31 Thread Emmanuel Mayssat
I have the following program. I am trying to have index the attributes of an object using __getitem__. Reading them this way works great, but assigning them a value doesn't Is there a way to do such a thing? (Almost like a named tuple, but with custom methods) class LIter(object): def __init__

multiple constructor __init__

2012-02-02 Thread Emmanuel Mayssat
Hello all, I would like to instantiate my class as follow QObject(, ) QObject() an example would be http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmenu.html How can I do this without have to specify parent= in the second version (I always need to supply the parent parameter, but I

Re: multiple constructor __init__

2012-02-03 Thread Emmanuel Mayssat
Yes, exactly like range http://coverage.livinglogic.de/Demo/classes/Range.py.html see handleargs function. Well that's short, but that's still too much code for what I want to do ;-) On Thu, Feb 2, 2012 at 7:43 PM, Terry Reedy wrote: > On 2/2/2012 8:09 PM, Emmanuel

list of properties

2012-02-16 Thread Emmanuel Mayssat
Hello, Is there a way to list 'properties' ? from PyQt4.QtCore import * class LObject(QObject): def __init__(self, parent=None): super(LObject, self).__init__(parent) self.arg1 = 'toto' def getArg2(self): return self.arg1 + " <--" arg2 = property(getArg2) l