Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #41910
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!eweka.nl!lightspeed.eweka.nl!194.109.133.86.MISMATCH!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <ian.g.kelly@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.002 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; '"""': 0.07; 'args': 0.07; 'method.': 0.07; 'string': 0.09; 'implements': 0.09; 'subject:string': 0.09; 'thx': 0.09; 'python': 0.11; 'def': 0.12; 'mostly': 0.14; '**kwargs)': 0.16; '**kwargs):': 0.16; 'braces': 0.16; 'declaration': 0.16; 'formatted': 0.16; "object's": 0.16; 'subject:format': 0.16; 'subject:python3': 0.16; 'url:file': 0.16; 'wrote:': 0.18; 'code.': 0.18; 'file,': 0.19; 'pointed': 0.19; 'directory.': 0.24; 'file.': 0.24; 'source': 0.25; 'pass': 0.26; 'code:': 0.26; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'am,': 0.29; 'array': 0.29; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'reply.': 0.31; 'url:python': 0.33; 'guess': 0.33; 'implemented': 0.33; 'at:': 0.34; 'received:209.85': 0.35; 'received:google.com': 0.35; 'version': 0.36; 'curious': 0.36; 'maintained': 0.36; 'method': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'skip:o 20': 0.38; 'to:addr :python-list': 0.38; 'itself': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'matter': 0.61; 'simply': 0.61; 'mar': 0.68; '26,': 0.68; 'containing': 0.69; 'press': 0.70; 'special': 0.74; 'url:cpython': 0.84; '2013': 0.98 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:in-reply-to:references:from:date:message-id :subject:to:content-type; bh=rno3VGMUDsJI3af2n8Vp9xxDUjNTruHxDHud5e5Js08=; b=g8sgj5Xhr7m/Noa0j6SyFODxgmp91pd6w/HmyCpZ5VVctaf5w+lRgPt6+erV3E3Ixa FGrkDYMFYBcKUjt3QHctnP+h48R4LhIjIcGhlFmycRuIszf5i10SqnB4rlNUfY2b1Kua pAbF3wL2rO8YLRrWixzSIOqkIEVk/NXddvLyJuN7n2h6fp3M5s1oagYAfaskmoPTyGsP Jx650WPTVFbZjS40G6gLD03ORrtD3iyGiwVp7MFuTvoBap8lpSZWBMC0DgiU6J8DoxqG jSBDfstaoBJrL9R4agLwt0sj1Za4zToXDRs/bafxJa+blcPqd2okbvDPJ2l+6TklAIxe T8KQ== |
| X-Received | by 10.58.245.40 with SMTP id xl8mr19588753vec.33.1364310474043; Tue, 26 Mar 2013 08:07:54 -0700 (PDT) |
| MIME-Version | 1.0 |
| In-Reply-To | <CAJQX3Dx2SV-uPznaRtTLAMYQD_dMW=r8hQfBpBSdAvKtzAGCog@mail.gmail.com> |
| References | <CAJQX3Dz-zZd7yL5Wc6hPJaP0=Mj0kCWAUvvonVH07stttRHivg@mail.gmail.com> <CALwzidkss-vdd5yPdwtMrgqANa8YEGKm3jPCgGG4vrvuR=LAdA@mail.gmail.com> <CAJQX3Dx2SV-uPznaRtTLAMYQD_dMW=r8hQfBpBSdAvKtzAGCog@mail.gmail.com> |
| From | Ian Kelly <ian.g.kelly@gmail.com> |
| Date | Tue, 26 Mar 2013 09:07:13 -0600 |
| Subject | Re: python3 string format |
| To | Python <python-list@python.org> |
| Content-Type | text/plain; charset=ISO-8859-1 |
| 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 | <http://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 | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3749.1364310482.2939.python-list@python.org> (permalink) |
| Lines | 32 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1364310482 news.xs4all.nl 6986 [2001:888:2000:d::a6]:38067 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:41910 |
Show key headers only | View raw
On Tue, Mar 26, 2013 at 4:51 AM, Shiyao Ma <i@introo.me> wrote:
> Thx for your reply.
> I am using pycharm and simply press "go to declaration" which directs me to
> a py file, containing the following code:
> def format(*args, **kwargs): # known special case of str.format
> """
> S.format(*args, **kwargs) -> string
>
> Return a formatted version of S, using substitutions from args and
> kwargs.
> The substitutions are identified by braces ('{' and '}').
> """
> pass
I would guess that Python declaration is maintained and used by
PyCharm for code intelligence.
> I am curious how you find the corresponding c source code.
The str object is mostly implemented in Objects/unicodeobject.c. The
int object is mostly implemented in Objects/longobject.c. Other
built-in types can also be found in that directory. Each has a
PyMethodDef[] global array that declares the implementations of the
object's methods. Finding the implementation is then just a matter of
grepping the source for its name.
The function I pointed you to before implements the str.__format__
method. The str.format method itself is at:
http://hg.python.org/cpython/file/84e73ace3d7e/Objects/stringlib/unicode_format.h#l942
I'm not sure why that one is implemented in a .h file.
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: python3 string format Ian Kelly <ian.g.kelly@gmail.com> - 2013-03-26 09:07 -0600
csiph-web