module string.py
Fredrik Lundh
fredrik at pythonware.com
Thu Jun 20 12:17:39 EDT 2002
"NOPollution" <r_proietti at yahoo.com> wrote:
> Where could I find the source code of the functions implemented in
> "string.py"?
The functions implemented in string.py are implemented in
string.py (obviously).
However, where that implementation looks something like
def lower(s):
return s.lower()
you need to look at the implementation of the "lower" method
of whatever "s" you want to pass to that function. Assuming
you're using strings, the implementations can be found in
Objects/stringobject.c
or
Objects/unicodeobject.c
depending on the string type.
To implement "lower", the latter uses Objects/unicodectype.c
which depends on data in Objects/unicodetype_db.h, which in
turn is generated by tools/unicode/makeunicodedata.py from
the Unicode database available from the Unicode Consortium.
(are you sure it's not easier to just read the library reference,
and be done with it?)
Btw, the source code can be found here (make sure to get the
tgz file, not the installers)
http://www.python.org/2.2.1/
</F>
More information about the Python-list
mailing list