[Python-Dev] _PyString_InsertThousandsGrouping() (original) (raw)
Eli Bendersky eliben at gmail.com
Thu May 23 06:39:46 CEST 2013
- Previous message: [Python-Dev] _PyString_InsertThousandsGrouping()
- Next message: [Python-Dev] Bilingual scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, May 22, 2013 at 9:18 PM, Carlos Nepomuceno < carlosnepomuceno at outlook.com> wrote:
> From: eliben at gmail.com [...] > I've found the following declaration in 'Objects/stringobject.c' but it > just defines PyInsertThousandsGrouping() as > PyStringInsertThousandsGrouping(): > > "#define PyInsertThousandsGrouping PyStringInsertThousandsGrouping" > > I'm looking for the opposite! > > No, you aren't :-) > > #define PyInsertThousandsGrouping PyStringInsertThousandsGrouping > #include "stringlib/localeutil.h" > > Now look inside "stringlib/localeutil.h" and think what the > pre-processor does with the function definition having the #define > above. > > Eli
lol I can see clearly now! :p That reminds me of "Which came first, the chicken or the egg?" Thank you! Somehow I got intrigued by such use... Do you know why they've put a lot of source code inside the header files?
This depends per use-case. Commonly, code is placed in header files in C to achieve some sort of C++-template-like behavior with the preprocessor. In particular, I think Objects/stringlib/formatter.h does this. Note this comment near its top:
/* Before including this, you must include either: stringlib/unicodedefs.h stringlib/stringdefs.h
Also, you should define the names: FORMAT_STRING FORMAT_LONG FORMAT_FLOAT FORMAT_COMPLEX to be whatever you want the public names of these functions to be. These are the only non-static functions defined here. */
Eli -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20130522/d8e4d02f/attachment.html>
- Previous message: [Python-Dev] _PyString_InsertThousandsGrouping()
- Next message: [Python-Dev] Bilingual scripts
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]