Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

u''.translate not documented #38184

Closed
mjpieters mannequin opened this issue Mar 19, 2003 · 6 comments
Closed

u''.translate not documented #38184

mjpieters mannequin opened this issue Mar 19, 2003 · 6 comments
Labels
docs Documentation in the Doc dir

Comments

@mjpieters
Copy link
Mannequin

mjpieters mannequin commented Mar 19, 2003

BPO 706546
Nosy @malemburg, @rhettinger, @mjpieters

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = <Date 2011-11-17.01:39:03.479>
created_at = <Date 2003-03-19.21:35:41.000>
labels = ['docs']
title = "u''.translate not documented"
updated_at = <Date 2011-11-17.01:39:03.479>
user = 'https://github.com/mjpieters'

bugs.python.org fields:

activity = <Date 2011-11-17.01:39:03.479>
actor = 'josharian'
assignee = 'none'
closed = True
closed_date = None
closer = None
components = ['Documentation']
creation = <Date 2003-03-19.21:35:41.000>
creator = 'mjpieters'
dependencies = []
files = []
hgrepos = []
issue_num = 706546
keywords = []
message_count = 6.0
messages = ['15207', '15208', '15209', '15210', '15211', '147787']
nosy_count = 4.0
nosy_names = ['lemburg', 'rhettinger', 'mjpieters', 'josharian']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue706546'
versions = []

@mjpieters
Copy link
Mannequin Author

mjpieters mannequin commented Mar 19, 2003

The behaviour of u''.translate is significantly
different from ''.translate, yet the difference is not
reflected in the documentation.

  • ''.translate takes one or two arguments, one a table
    of 256 characters for the translation target and the
    other a string containing characters to be removed.

  • u''.translate only takes on argument, which is a
    mapping from unicode ordinal to unicode ordinal,
    ustring or None.

See also print u''.translate.__doc__

@mjpieters mjpieters mannequin closed this as completed Mar 19, 2003
@mjpieters mjpieters mannequin added the docs Documentation in the Doc dir label Mar 19, 2003
@mjpieters mjpieters mannequin closed this as completed Mar 19, 2003
@mjpieters mjpieters mannequin added the docs Documentation in the Doc dir label Mar 19, 2003
@malemburg
Copy link
Member

Logged In: YES
user_id=38388

Isn't the documentation clear enough about the difference ?

Note that u.translate() is not really all that useful. You
are much
better off with writing your own charmap based codec which
is not really difficult: just take a look at e.g. cp1251.py.

@mjpieters
Copy link
Mannequin Author

mjpieters mannequin commented Mar 20, 2003

Logged In: YES
user_id=116747

No, the documentation on u''.translate is *not present*. The
Python Library Reference makes no mention of a difference. See:

http://www.python.org/doc/current/lib/string-methods.html

I don't really care how it is of little use, I just need the
documentation to be up to date so I don't have to scratch my
head why I get this weird error that translate only takes
one argument; as it turns out the strings I was calling this
on were unicode strings.

@malemburg
Copy link
Member

Logged In: YES
user_id=38388

I see. In that case, I'd suggest you provide a patch to fill up
the gaps.

Thanks.

@rhettinger
Copy link
Contributor

Logged In: YES
user_id=80475

Added the requested clarification.
See Doc/lib/libstring.tex 1.51

@josharian
Copy link
Mannequin

josharian mannequin commented Nov 17, 2011

This documentation change didn't make it into the docs for translate in the string module -- see http://docs.python.org/library/string.html. It'd be great to add it there as well, as I just got bitten by this. :)

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

2 participants