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 <tjre...@udel.edu> wrote: > On 2/2/2012 8:09 PM, Emmanuel Mayssat wrote: > >> Hello all, >> >> I would like to instantiate my class as follow >> >> >> QObject(<param1>, <parent>) >> QObject(<parent>) >> >> an example would be >> http://www.riverbankcomputing.**co.uk/static/Docs/PyQt4/html/**qmenu.html<http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qmenu.html> >> >> How can I do this without have to specify parent=<parent> in the second >> version >> (I always need to supply the parent parameter, but I would like to >> supply it last) >> > > The same way range(stop) versus range(start,stop) works. > But I really recommend against that api. > It makes both doc and code messy. > You need a really good reason to not use the obvious > def __init__(self, parent, param=default):... > > -- > Terry Jan Reedy > > -- > http://mail.python.org/**mailman/listinfo/python-list<http://mail.python.org/mailman/listinfo/python-list> >
-- http://mail.python.org/mailman/listinfo/python-list