[ python-Feature Requests-1592899 ] "".translate() docs should mention string.maketrans()
SourceForge.net
noreply at sourceforge.net
Mon Dec 4 18:42:07 CET 2006
Feature Requests item #1592899, was opened at 2006-11-08 21:23
Message generated for change (Comment added) made by effbot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1592899&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Documentation
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Ori Avtalion (salty-horse)
Assigned to: Raymond Hettinger (rhettinger)
Summary: "".translate() docs should mention string.maketrans()
Initial Comment:
The translate() documentation at
http://docs.python.org/lib/string-methods.html#l2h-268
should mention the string.maketrans helper function.
maketrans also mentions "regex.compile" - that should
probably be "re.compile" (although it's less readable).
re.compile should mention maketrans as well.
----------------------------------------------------------------------
>Comment By: Fredrik Lundh (effbot)
Date: 2006-12-04 18:42
Message:
Logged In: YES
user_id=38376
Originator: NO
Aha. The regex documentation says:
compile (pattern[, translate]) /.../ The optional argument translate, if
present, must be a 256-character string indicating how characters (both of
the pattern and of the strings to be matched) are translated before
comparing them; the i-th element of the string gives the translation for
the character with ASCII code i. This can be used to implement
case-insensitive matching; see the casefold data item below.
which means that it was indeed useful for regex.compile. afaik,
re.compile doesn't support arbitrary mappings, so that reference should be
removed.
----------------------------------------------------------------------
Comment By: Ori Avtalion (salty-horse)
Date: 2006-12-04 18:08
Message:
Logged In: YES
user_id=854801
Originator: YES
>"re.compile should mention maketrans as well"
>why?
The maketrans doc says:
"Return a translation table suitable for passing to translate() or
regex.compile()"
I don't have any use case for how it's useful to regex.compile. Maybe
there is none, and the mention can be removed.
----------------------------------------------------------------------
Comment By: Fredrik Lundh (effbot)
Date: 2006-12-04 10:20
Message:
Logged In: YES
user_id=38376
Originator: NO
"re.compile should mention maketrans as well"
why?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1592899&group_id=5470
More information about the Python-bugs-list
mailing list