[PyQt] PyQt overloaded constructors

Erick Tryzelaar idadesub at users.sourceforge.net
Wed Oct 1 05:06:28 BST 2008


On Tue, Sep 30, 2008 at 6:27 AM, Georg Altmann <george at george-net.de> wrote:
> Can I support the overloaded constructors in my subclass?

I believe what sip/PyQt is essentially manually extracting the
arguments, like this:

def __init__(self, *args):
  if len(args) == 1:
    x = args[0]
    assert isinstance(x, QUndoCommand)
  elif len(args) == 2:
    x, y = args
    assert isinstance(x, Str)
    assert isinstance(y, QUndoCommand)
  else:
    raise TooManyArgs

or something like that.


More information about the PyQt mailing list