Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #65938 > unrolled thread
| Started by | Zachary Ware <zachary.ware+pylist@gmail.com> |
|---|---|
| First post | 2014-02-11 12:25 -0600 |
| Last post | 2014-02-11 12:25 -0600 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Metaprogramming question Zachary Ware <zachary.ware+pylist@gmail.com> - 2014-02-11 12:25 -0600
| From | Zachary Ware <zachary.ware+pylist@gmail.com> |
|---|---|
| Date | 2014-02-11 12:25 -0600 |
| Subject | Re: Metaprogramming question |
| Message-ID | <mailman.6690.1392143174.18130.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web