[issue21279] str.translate documentation incomplete

2015-08-05 Thread Zachary Ware
Zachary Ware added the comment: Very minor grammatical fixes, reflowed the .rst docs, and re-added the codecs module mention in a less obtrusive manner, but the patch is committed. Thank you Kinga, Martin, and John! -- nosy: +zach.ware ___ Python

[issue21279] str.translate documentation incomplete

2015-08-05 Thread Roundup Robot
Roundup Robot added the comment: New changeset ae53bd5decae by Zachary Ware in branch '3.4': Issue #21279: Flesh out str.translate docs https://hg.python.org/cpython/rev/ae53bd5decae New changeset 064b569e38fe by Zachary Ware in branch '3.5': Issue #21279: Merge with 3.4

[issue21279] str.translate documentation incomplete

2015-06-20 Thread Martin Panter
Martin Panter added the comment: Patch v6 looks okay, so I think it is ready to commit. -- stage: patch review - commit review versions: +Python 3.6 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279

[issue21279] str.translate documentation incomplete

2015-01-25 Thread John Posner
John Posner added the comment: Per Martin's suggestion, deltas from issue21279.v5.patch: * no change to patch for doc/library/stdtypes.rst * doc string reflowed in patch for objects/unicodeobject.c -- Added file: http://bugs.python.org/file37855/issue21279.v6.patch

[issue21279] str.translate documentation incomplete

2015-01-25 Thread Berker Peksag
Changes by Berker Peksag berker.pek...@gmail.com: -- nosy: +berker.peksag ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279 ___ ___

[issue21279] str.translate documentation incomplete

2015-01-24 Thread Martin Panter
Martin Panter added the comment: I’m happy with the new wording in v5. Maybe the docstring in the C module could be reflowed though. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279

[issue21279] str.translate documentation incomplete

2014-12-23 Thread John Posner
John Posner added the comment: issue21279.v5.patch tries to apply the comments in msg233013, msg233014, and msg233025 to the Doc/library/stdtypes.rst writeup. Then it applies some of the same language to the docstring in Objects/unicodeobject.c. -- Added file:

[issue21279] str.translate documentation incomplete

2014-12-22 Thread Terry J. Reedy
Terry J. Reedy added the comment: I agree with Serhiy: no bullet points, links to glossary (at least in doc), without repeating. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279 ___

[issue21279] str.translate documentation incomplete

2014-12-22 Thread Martin Panter
Martin Panter added the comment: The problem with mappings and sequences is that they both require len() and iter() implementations, but str.translate() only requires __getitem__(). Perhaps a qualifier could work, like: The table must implement the __getitem__() method of mappings and

[issue21279] str.translate documentation incomplete

2014-12-21 Thread Martin Panter
Martin Panter added the comment: Patch v4 with John’s doc string wording -- Added file: http://bugs.python.org/file37522/issue21279.v4.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279

[issue21279] str.translate documentation incomplete

2014-12-21 Thread John Posner
John Posner added the comment: Patch of 12-21 looks good, Martin. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279 ___ ___ Python-bugs-list

[issue21279] str.translate documentation incomplete

2014-12-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Proposed wording looks superfluously verbose to me. Look also at description in Include/unicodeobject.h: /* Translate a string by applying a character mapping table to it and return the resulting Unicode object. The mapping table must map Unicode

[issue21279] str.translate documentation incomplete

2014-12-21 Thread Martin Panter
Martin Panter added the comment: Serhiy can you point out which bits are too verbose? Perhaps you prefer it without the bullet list like in the earlier 2014-12-13 version of the patch. Looking at the C API, I see a couple problems there: * Omits mentioning that an ordinal can map to a

[issue21279] str.translate documentation incomplete

2014-12-21 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Serhiy can you point out which bits are too verbose? Perhaps you prefer it without the bullet list like in the earlier 2014-12-13 version of the patch. I prefer it without the bullet list and without LookupError expansion (there is a link to LookupError

[issue21279] str.translate documentation incomplete

2014-12-19 Thread John Posner
John Posner added the comment: Regarding Martin's patch of 12-18: stdtypes.rst -- looks good to me unicodeobject.c -- I suggest changing this sentence: If a character is not in the table, the subscript operation should raise LookupError, and the character is left untouched. ... to: If the

[issue21279] str.translate documentation incomplete

2014-12-17 Thread Martin Panter
Martin Panter added the comment: Here is a new patch based on John’s suggestion -- Added file: http://bugs.python.org/file37487/issue21279.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279

[issue21279] str.translate documentation incomplete

2014-12-15 Thread John Posner
John Posner added the comment: Kindly ignore message #2 on the Rietveld page (sorry for the channel noise). Here's my suggested revision: Return a copy of the string *str* in which each character has been mapped through the given translation *table*. The table must be a subscriptable object,

[issue21279] str.translate documentation incomplete

2014-12-15 Thread Martin Panter
Martin Panter added the comment: I’m largely happy with any of these revisions. If I end up doing another patch I would omit the *str* (it is a class name, not a parameter). Also I would omit the range(2^20) claim. Unless people think it is important; why is it different to sys.maxunicode + 1

[issue21279] str.translate documentation incomplete

2014-12-13 Thread Terry J. Reedy
Terry J. Reedy added the comment: Many people may not know that IndexError and KeyError are subclasses of LookupError. I have not decided what to add yet, but I think we are close. -- ___ Python tracker rep...@bugs.python.org

[issue21279] str.translate documentation incomplete

2014-12-12 Thread Martin Panter
Martin Panter added the comment: Update patch with typo fixed, removed note about the “codecs” module (which I never found useful either), and updated the doc string with similar wording. Terry, do you think the wording in the patch is good enough, or do you think some of your proposed

[issue21279] str.translate documentation incomplete

2014-04-18 Thread Kinga Farkas
Kinga Farkas added the comment: I have created a patch based on Martin Panter's suggestions. Please let me know if it is off or there should be additional changes included. -- keywords: +patch nosy: +lilbludot Added file: http://bugs.python.org/file34966/issue21279.patch

[issue21279] str.translate documentation incomplete

2014-04-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: The docstring is more accurate. str.translate.__doc__ 'S.translate(table) - str\n\nReturn a copy of the string S, where all characters have been mapped\nthrough the given translation table, which must be a mapping of\nUnicode ordinals to Unicode ordinals,

[issue21279] str.translate documentation incomplete

2014-04-18 Thread Terry J. Reedy
Terry J. Reedy added the comment: I see that we mostly added the same info. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279 ___ ___

[issue21279] str.translate documentation incomplete

2014-04-17 Thread Josh Rosenberg
Josh Rosenberg added the comment: For the record, I have intentionally used bytes.maketrans to make translation table for str.translate for precisely this reason; it's much faster to look up a ordinal in a bytes object than in a dictionary. Before the recent (partial) patch for str.translate

[issue21279] str.translate documentation incomplete

2014-04-16 Thread bob gailer
New submission from bob gailer: Documentation for str.translate only mentions a dictionary for the translation table. Actually any iterable can be used, as long as its elements are integer, None or str. Recommend wording: str.translate(translation_table) Return a copy of the s where all

[issue21279] str.translate documentation incomplete

2014-04-16 Thread Raymond Hettinger
Changes by Raymond Hettinger raymond.hettin...@gmail.com: -- keywords: +easy stage: - patch review versions: +Python 3.4, Python 3.5 -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21279

[issue21279] str.translate documentation incomplete

2014-04-16 Thread Martin Panter
Martin Panter added the comment: I suspect “iterable” is the wrong term. isinstance(set(), Iterable) True abc.translate(set()) TypeError: 'set' object does not support indexing abc.translate(object()) TypeError: 'object' object is not subscriptable Maybe “indexable” or “subscriptable” would