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


Groups > comp.lang.python > #97102

Re: Modifying signature of ctor in class

Path csiph.com!au2pb.net!feeder.erje.net!1.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.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.025
X-Spam-Evidence '*H*': 0.95; '*S*': 0.00; 'python': 0.10; 'def': 0.13; 'decent': 0.16; 'received:172.18.0': 0.16; 'subject:class': 0.16; 'version.': 0.18; 'versions': 0.20; 'to:2**1': 0.21; 'parameter': 0.22; 'pass': 0.22; 'import': 0.24; 'header:In-Reply- To:1': 0.24; 'module': 0.25; 'function': 0.28; '**kwargs):': 0.29; 'inspect': 0.29; 'foo': 0.33; "i'll": 0.33; 'thanks!': 0.34; 'nothing.': 0.35; 'skip:p 30': 0.35; 'should': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'skip:p 20': 0.38; 'test': 0.39; 'to:addr:python.org': 0.40; 'to:name:python': 0.84
X-Authority-Analysis v=2.1 cv=av94c3tV 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=2bHAR0zIYXhSxSBwC4IA: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 Ian Kelly <ian.g.kelly@gmail.com>, Python <python-list@python.org>
Subject Re: Modifying signature of ctor in class
Thread-Topic Modifying signature of ctor in class
Thread-Index AQHQ9weIGzVVeo4s60Sc6dvZps29lZ5MohyAgAACkwD//6aWXw==
Date Thu, 24 Sep 2015 23:01:24 +0000
References <5cb33b569cf14dfea9424c006c9abc95@exch.activenetwerx.com> <CALwzidk5H_hevjuiJjYyJTM9wj5hZbmZa=G9L8ctTZ+geJu+=A@mail.gmail.com>
In-Reply-To <CALwzidk5H_hevjuiJjYyJTM9wj5hZbmZa=G9L8ctTZ+geJu+=A@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 MS4wfOEzVCjXTJNuZGiOfcLDHJLsDDlSU54V5q+TYmJ9eKZoFQDpBxoZWiosOiLFRJcWhBPpnE+2zLkZmWMvkj2wMOjQL0cwfb1OUix2O4IXD4qzqd46IIqiES8sWu8H0uX69cUaDCCCvig79gS+CSyEvl0BGpEzfRXdW42eke8S0F9Bx1C/5YlOCz5QaOkwND1itw==
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.153.1443135694.28679.python-list@python.org> (permalink)
Lines 19
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1443135694 news.xs4all.nl 23738 [2001:888:2000:d::a6]:58446
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:97102

Show key headers only | View raw


> py> from inspect import Signature, Parameter
> py> def foo(*args, **kwargs): pass
> ...
> py> foo.__signature__ = Signature([Parameter('x',
> Parameter.POSITIONAL_OR_KEYWORD), Parameter('y',
> Parameter.KEYWORD_ONLY)])
> py> help(foo)
> Help on function foo in module __main__:
> 
> foo(x, *, y)

That actually should harmlessly support Python versions less than 3.3
while simply accomplishing nothing. I don't even need a test for the version.

I'll go with that as a decent trade off.

Thanks!
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 23:01 +0000

csiph-web