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


Groups > comp.lang.python > #65938

Re: Metaprogramming question

References <D8A3D8A2-7CAB-41CD-9EF8-E6B91AFD0F15@gmail.com>
From Zachary Ware <zachary.ware+pylist@gmail.com>
Date 2014-02-11 12:25 -0600
Subject Re: Metaprogramming question
Newsgroups comp.lang.python
Message-ID <mailman.6690.1392143174.18130.python-list@python.org> (permalink)

Show all headers | View raw


On Tue, Feb 11, 2014 at 12:13 PM, Travis Griggs <travisgriggs@gmail.com> wrote:
> So here’s my basic question. Is there anyway to programatically query that information in python code?
>
> inspect.signature(datetime.datetime.now)
>
> just gives a ValueError. inspect must only be good for the python code that I write, in python. Is there another way to dig out what the interpreter knows there?

Fixing that issue is in the works.  Argument Clinic[1][2] has been
added for Python 3.4 which, once all C functions have been converted,
will provide signature information for all builtins (functions written
in C).  If you try out the Python 3.4 RC1[3], you can try
inspect.signature(datetime.datetime.now) again and get the information
you expect: that's one of the (unfortunately relatively few) builtins
that is already converted.

Aside from the Argument Clinic effort, builtin functions are pretty
much black boxes to Python--hence why we're trying to fix it!

-- 
Zach

[1] http://docs.python.org/3.4/howto/clinic.html
[2] http://hg.python.org/cpython/file/default/Tools/clinic/clinic.py
[3] http://python.org/download/releases/3.4.0/

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


Thread

Re: Metaprogramming question Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-02-11 12:25 -0600

csiph-web