Path: csiph.com!goblin1!goblin.stu.neva.ru!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'modify': 0.04; 'constructor': 0.07; 'dynamically': 0.07; 'attribute.': 0.09; 'python': 0.10; 'thu,': 0.15; '24,': 0.16; '2:28': 0.16; 'subject:class': 0.16; 'wrote:': 0.16; 'string': 0.17; 'input': 0.18; '2015': 0.20; 'accommodate': 0.22; 'doc': 0.22; 'fine,': 0.22; 'sep': 0.22; 'attach': 0.23; 'header:In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.27; 'function': 0.28; 'strings,': 0.29; 'skip:_ 10': 0.32; 'class': 0.33; 'this?': 0.34; 'add': 0.34; 'received:google.com': 0.35; 'done': 0.35; 'there': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'setting': 0.37; 'signature': 0.37; 'anything': 0.38; 'building': 0.38; 'to:addr:python.org': 0.40; 'where': 0.40; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=Bb9bz9eW5g2FOwy1wSTM7mYVomtsc4QN5I3Dhna1f68=; b=PtT1AGfYXeUBWHK/q0el7N5VgVMxfbEEIEY1fnOU/0KXBYpDnOlwCyT1D7czwx3hmP dRRSmNfI6FmOGgmC/Scq+QTP1Tv2gK+1AXBbQefTZxGZtQOWn9MNZzFuh5u9kb+F9kMb 03uZZloURl6XC8B0hZqmrwo+OBRsdV5x3YQemquk4whyzO99D8zjSfGN9gkDlSfTrYq3 miKlc6KpCk7kqan26BFEe97SjZP73cFkAVVxVZ2o8SkEzoKokMhNdUeJZGv22L9e8zu8 zL140tj+0vgftp835VhRN5OZDrjkJ6YcgmVwYT3VpF+E56K0Q1KqhtR1wTyF0qEB3lPK y4DA== X-Received: by 10.170.194.22 with SMTP id l22mr1838189yke.63.1443132657022; Thu, 24 Sep 2015 15:10:57 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <5cb33b569cf14dfea9424c006c9abc95@exch.activenetwerx.com> References: <5cb33b569cf14dfea9424c006c9abc95@exch.activenetwerx.com> From: Ian Kelly Date: Thu, 24 Sep 2015 16:10:17 -0600 Subject: Re: Modifying signature of ctor in class To: Python Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 13 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1443132660 news.xs4all.nl 23766 [2001:888:2000:d::a6]:44240 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:97098 On Thu, Sep 24, 2015 at 2:28 PM, Joseph L. Casale wrote: > I have a class factory where I dynamically add a constructor to the class output. > The method is a closure and works just fine, however to accommodate the varied > input its signature is (*args, **kwargs). > > While I modify the doc strings, the ctor sig is not optimal. Without building > this a string and using eval, is there anything that can be done about this? In Python 3.3+ you can attach a Signature object to a function by setting the function's __signature__ attribute. In Python 3.4+ the __signature__ is used in generating the signature for PyDoc and help().