multiple constructor __init__
Emmanuel Mayssat
emayssat at gmail.com
Fri Feb 3 11:30:50 EST 2012
More information about the Python-list mailing list
Fri Feb 3 11:30:50 EST 2012
- Previous message (by thread): multiple constructor __init__
- Next message (by thread): python CPU usage 99% on ubuntu aws instance using eventlet
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 <tjreedy at 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> > -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20120203/c3a051ce/attachment-0001.html>
- Previous message (by thread): multiple constructor __init__
- Next message (by thread): python CPU usage 99% on ubuntu aws instance using eventlet
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list