Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #97102
| From | "Joseph L. Casale" <jcasale@activenetwerx.com> |
|---|---|
| Subject | Re: Modifying signature of ctor in class |
| Date | 2015-09-24 23:01 +0000 |
| References | <5cb33b569cf14dfea9424c006c9abc95@exch.activenetwerx.com> <CALwzidk5H_hevjuiJjYyJTM9wj5hZbmZa=G9L8ctTZ+geJu+=A@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.153.1443135694.28679.python-list@python.org> (permalink) |
> 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
Re: Modifying signature of ctor in class "Joseph L. Casale" <jcasale@activenetwerx.com> - 2015-09-24 23:01 +0000
csiph-web