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


Groups > comp.lang.python > #65938

Re: Metaprogramming question

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <zachary.ware@gmail.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; 'python.': 0.02; 'argument': 0.05; 'interpreter': 0.05; 'builtin': 0.09; 'url:releases': 0.09; 'works.': 0.09; 'subject:question': 0.10; 'python': 0.11; 'url:download': 0.12; 'anyway': 0.14; 'question.': 0.14; '(functions': 0.16; 'builtins': 0.16; 'code?': 0.16; 'converted,': 0.16; 'dig': 0.16; 'there?': 0.16; 'travis': 0.16; 'url:file': 0.16; 'url:py': 0.16; 'which,': 0.16; 'write,': 0.16; 'sender:addr:gmail.com': 0.17; 'fix': 0.17; 'wrote:': 0.18; 'trying': 0.19; 'url:default': 0.19; 'written': 0.21; 'feb': 0.22; 'to:name:python-list@python.org': 0.22; 'skip:i 40': 0.24; 'query': 0.26; 'header:In-Reply-To:1': 0.27; '[1]': 0.29; '[2]': 0.30; 'message-id:@mail.gmail.com': 0.30; 'gives': 0.31; 'code': 0.31; 'fixing': 0.31; 'inspect': 0.31; "we're": 0.32; 'another': 0.32; 'url:python': 0.33; 'basic': 0.35; 'knows': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'url:org': 0.36; 'to:addr:python-list': 0.38; 'issue': 0.38; 'pm,': 0.38; 'aside': 0.39; 'to:addr:python.org': 0.39; 'black': 0.61; 'url:3': 0.61; 'information': 0.63; 'provide': 0.64; 'relatively': 0.65; 'url:0': 0.67; 'it!': 0.67; 'url:4': 0.69; '3.4': 0.84; 'subject:skip:M 10': 0.84; 'url:cpython': 0.84; 'boxes': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:content-type:content-transfer-encoding; bh=PTj8FFaf/illMPLScJM+v+GaZvKJTx/1z7qm1FnzL9w=; b=UyxBM7NMyDwiAYNpAE3XtTBhn8PMTG65p2rKiIIL72N4BuneVghEOiNFFhcWilULsL foRUGjLscfVvzZc7YlVb+61f+waYEcT824f+ifqRzy/uKRbvKAzi5iCsJond6Ttkn3oD nxHMxefSxuBUJJzoQDaqnG4FxowXvovfHY+U8shTKJ/hjfZwX4M9eHmYhcQf4fcNdb2A E09Oa3MNDMuUXP5v7zccWgDLjTPq8iQ6Tsa2pWLgMw4Xhmgb6nOxb24+wr7Wd95rOeHW 7bkEvGDuSDhU+cHPXA9xpsghb41VFy2Wq2uT3WBI4bwD1u4K8ZbvzNT/x879f7w3J3TN yXog==
X-Received by 10.205.104.194 with SMTP id dn2mr20154bkc.96.1392143167790; Tue, 11 Feb 2014 10:26:07 -0800 (PST)
MIME-Version 1.0
Sender zachary.ware@gmail.com
In-Reply-To <D8A3D8A2-7CAB-41CD-9EF8-E6B91AFD0F15@gmail.com>
References <D8A3D8A2-7CAB-41CD-9EF8-E6B91AFD0F15@gmail.com>
From Zachary Ware <zachary.ware+pylist@gmail.com>
Date Tue, 11 Feb 2014 12:25:47 -0600
X-Google-Sender-Auth JMOQMsL1khK0u0lfsWaoRB5OskA
Subject Re: Metaprogramming question
To "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.6690.1392143174.18130.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1392143175 news.xs4all.nl 2972 [2001:888:2000:d::a6]:37227
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:65938

Show key headers only | 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