Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #97095

Re: Modifying signature of ctor in class

Path csiph.com!eternal-september.org!feeder.eternal-september.org!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.news.xs4all.nl!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 <jcasale@activenetwerx.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'args': 0.04; 'cc:addr :python-list': 0.09; 'definition,': 0.09; 'ide': 0.09; 'rebuild': 0.09; 'tab': 0.09; 'python': 0.10; 'itself.': 0.11; 'argument': 0.15; 'everyone,': 0.15; 'chris,': 0.16; 'docstring': 0.16; 'eval': 0.16; 'received:172.18.0': 0.16; 'stuff,': 0.16; 'subject:class': 0.16; 'string': 0.17; 'attribute': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'fairly': 0.22; '(or': 0.23; 'header:In-Reply-To:1': 0.24; 'equivalent': 0.27; 'function': 0.28; 'idea': 0.28; 'looks': 0.29; 'helpful.': 0.29; 'too.': 0.30; 'point': 0.33; 'problem': 0.33; 'list': 0.34; 'could': 0.35; 'but': 0.36; 'instead': 0.36; 'subject:: ': 0.37; 'thanks': 0.37; 'easily': 0.39; 'where': 0.40; 'still': 0.40; 'your': 0.60; "you'll": 0.61; 'entire': 0.61; 'effective': 0.63; 'completing': 0.72
X-Authority-Analysis v=2.1 cv=W4fyL0ik c=1 sm=1 tr=0 a=g3mLq75WYuDrh3Lt0JSDww==:117 a=g3mLq75WYuDrh3Lt0JSDww==:17 a=QC7fh9NfAAAA:8 a=5pFAO2ZBLFIA:10 a=8nJEP1OIZ-IA:10 a=ff-B7xzCdYMA:10 a=Wi8mAD0AR7pklaCSQ0gA:9 a=wPNLvfGTeEIA:10
X-Spam-Checker-Version SpamAssassin 3.4.0 (2014-02-07) on mail.activenetwerx.com
X-Spam-Level *
X-Spam-Status No, score=1.3 required=5.0 tests=RDNS_NONE autolearn=no autolearn_force=no version=3.4.0
From "Joseph L. Casale" <jcasale@activenetwerx.com>
To Chris Angelico <rosuav@gmail.com>
CC "python-list@python.org" <python-list@python.org>
Subject Re: Modifying signature of ctor in class
Thread-Topic Modifying signature of ctor in class
Thread-Index AQHQ9weIGzVVeo4s60Sc6dvZps29lZ5MmVwA//+chPI=
Date Thu, 24 Sep 2015 21:45:45 +0000
References <CAPTjJmqCmXOx=KfkewnR7GR__qU0NPS7R=aqZ0BK_N4J9zXiBg@mail.gmail.com>
In-Reply-To <CAPTjJmqCmXOx=KfkewnR7GR__qU0NPS7R=aqZ0BK_N4J9zXiBg@mail.gmail.com>
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
x-ms-exchange-transport-fromentityheader Hosted
x-originating-ip [72.29.233.193]
Content-Type text/plain; charset="iso-8859-1"
Content-Transfer-Encoding quoted-printable
MIME-Version 1.0
X-CMAE-Envelope MS4wfFRIFIZmJkjd5ukCQ9eT+NivrAc2X9q5MUSzsYK0BGtIpBvGY6Nl0MDFz6AOeG926xHE/0oNv/DQ8rxhSpUB7at9JoFwqJ3OrNFh44M4BLhczCZPs1voMaN4nr2nteB+ssrKQalzByUWqhOuDJz4kFX97QmkaUR9f10b80kr+HbjizgzvvwHnLJW0AoQU39iVw==
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.147.1443131216.28679.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1443131216 news.xs4all.nl 23762 [2001:888:2000:d::a6]:35578
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:97095

Show key headers only | View raw


> I don't think you can easily change the function's own definition,
> other than by using eval (or equivalent shenanigans, like crafting
> your own bytecode); but as of Python 3.something, the help() function
> looks for a __wrapped__ attribute and will take function args from
> that instead of the function itself. That way, when you use
> functools.wraps(), it copies in the docstring and stuff, and as far as
> help() is concerned, copies in the argument list too.
> 
> No idea whether you'll be able to do that too, but it's a fairly
> effective way to get around the problem if you can.

Hi Chris,
That is helpful. It still leaves me with generating a string function
and eval'ing or compiling it to swipe the sig. At the point I could
rebuild the entire function and simply apply it.

Where all but a valid sig helps is for introspection such as tab completing
with ipython or using an IDE etc.

Thanks everyone,
jlc

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Modifying signature of ctor in class "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-09-24 21:45 +0000

csiph-web