Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #19821
| From | Terry Reedy <tjreedy@udel.edu> |
|---|---|
| Subject | Re: multiple constructor __init__ |
| Date | 2012-02-02 22:43 -0500 |
| References | <CACB6ZmB9ofRz+ZAjqbbnwm2GfL9Vwth+jrz2mAQoMBp6-x5o2A@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.5389.1328240613.27778.python-list@python.org> (permalink) |
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 > > 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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: multiple constructor __init__ Terry Reedy <tjreedy@udel.edu> - 2012-02-02 22:43 -0500
csiph-web