Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'api.': 0.05; 'received:verizon.net': 0.07; 'terry': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'def': 0.13; 'instantiate': 0.16; 'parameter,': 0.16; 'reedy': 0.16; 'url:riverbankcomputing': 0.16; 'versus': 0.16; 'wrote:': 0.16; 'jan': 0.19; 'header:In-Reply- To:1': 0.22; 'works.': 0.23; 'specify': 0.24; 'code': 0.25; 'pm,': 0.26; 'all,': 0.27; 'example': 0.28; 'second': 0.29; 'class': 0.29; 'parent': 0.30; 'version': 0.31; 'header:User-Agent:1': 0.33; 'to:addr:python-list': 0.33; 'doc': 0.34; 'header:X -Complaints-To:1': 0.34; 'but': 0.37; 'received:org': 0.37; 'skip:_ 10': 0.37; 'url:docs': 0.39; 'subject:: ': 0.39; 'to:addr:python.org': 0.40; 'url:uk': 0.40; 'url:co': 0.63; 'supply': 0.68; 'emmanuel': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: multiple constructor __init__ Date: Thu, 02 Feb 2012 22:43:16 -0500 References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-74-109-121-73.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1328240613 news.xs4all.nl 6860 [2001:888:2000:d::a6]:37059 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:19821 On 2/2/2012 8:09 PM, Emmanuel Mayssat wrote: > 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 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