This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2013年04月24日 13:45 by ncoghlan, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| 17827.diff | Grant, 2013年07月08日 07:17 | 17827-3.4 | review | |
| issue17827_docs_py27.diff | ncoghlan, 2013年11月04日 09:28 | Docs patch for Python 2.7 | review | |
| Messages (13) | |||
|---|---|---|---|
| msg187700 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年04月24日 13:45 | |
The codecs module has long offered encode() and decode() convenience functions (since 2004: http://hg.python.org/cpython-fullhistory/rev/8ea2cb1ec598), but they're not documented (except through docstrings). We should fix that. From the docstrings: ========== encode(obj, [encoding[,errors]]) -> object Encodes obj using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a ValueError. Other possible values are 'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name registered with codecs.register_error that can handle ValueErrors. ========== decode(obj, [encoding[,errors]]) -> object Decodes obj using the codec registered for encoding. encoding defaults to the default encoding. errors may be given to set a different error handling scheme. Default is 'strict' meaning that encoding errors raise a ValueError. Other possible values are 'ignore' and 'replace' as well as any other name registered with codecs.register_error that is able to handle ValueErrors. ========== Note that the difference between the convenience functions in the codecs module and the methods on str, bytes and bytearray is that the latter have additional type checks to limit their usage to text encodings. str.encode expects a str->bytes conversion, while bytes.decode and bytearray.decode both expect the codec to produce a str object. codecs.encode and codecs.decode are both arbitrary object->object conversions, limited only by whatever the chosen codec supports. |
|||
| msg187765 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年04月25日 07:51 | |
Note that in 2.7, these docs should have a ":versionadded: 2.4" marker, while in 3.3 and 3.4, they shouldn't have a version added marker at all. These functions should also get an entry in the 3.4 What's New, even though they're not actually new. |
|||
| msg187866 - (view) | Author: Tshepang Lekhonkhobe (tshepang) * | Date: 2013年04月26日 17:38 | |
So, why place them in What's New? |
|||
| msg187867 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2013年04月26日 17:51 | |
To advertise them? It should be explained that they are not new, but that now they are documented and can/should be used. |
|||
| msg187871 - (view) | Author: Tshepang Lekhonkhobe (tshepang) * | Date: 2013年04月26日 19:32 | |
I was not aware that such things are placed in What's New. I just looked at such a document for 3.3... makes a lot of sense. |
|||
| msg187910 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年04月27日 15:21 | |
This is only the second case I'm aware of where a particularly interesting piece of functionality didn't get mentioned in the appropriate What's New doc. For the other case, the zipfile execution support, we just added it in to the 2.6 What's New long after 2.6 had been released. To this day, most people don't know about that capability, which is why I suggest it's worth handling the current case (codecs.encode and codecs.decode) differently and noting their existence in the next What's New doc that people are likely to read :) |
|||
| msg192625 - (view) | Author: Grant (Grant) | Date: 2013年07月08日 07:17 | |
codecs module and 'whats new' doc patch for 3.4 |
|||
| msg198848 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年10月02日 15:17 | |
We should fix the docs for the earlier versions as well. |
|||
| msg199713 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年10月13日 14:56 | |
New changeset b607ce6c9ee6 by Nick Coghlan in branch '3.3': Issue #17827: Document codecs.encode and codecs.decode http://hg.python.org/cpython/rev/b607ce6c9ee6 New changeset 32f3d6721c84 by Nick Coghlan in branch 'default': Issue #17827: document codecs.encode and codecs.decode http://hg.python.org/cpython/rev/32f3d6721c84 |
|||
| msg199718 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年10月13日 15:05 | |
Still need to backport this to 2.7 (Thanks for the preliminary patch Grant, but I'm afraid it didn't make it into what I ended up committing) |
|||
| msg202099 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年11月04日 09:28 | |
Hmm, I just noticed an interesting issue here in drafting the 2.7 backport: as near as I can tell, these aren't tested, so other implementations that failed to provide them would pass the 2.7 and 3.3 test suites. |
|||
| msg202101 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2013年11月04日 09:47 | |
Oops, never mind - the tests are already there (and have been since MAL's original commit prior to Python 2.4), I just fail at searching code. |
|||
| msg202108 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2013年11月04日 10:08 | |
New changeset bdb30bdf60a5 by Nick Coghlan in branch '2.7': Close #17827: Document codecs.encode & codecs.decode http://hg.python.org/cpython/rev/bdb30bdf60a5 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:44 | admin | set | github: 62027 |
| 2013年11月04日 10:08:46 | python-dev | set | status: open -> closed resolution: fixed messages: + msg202108 stage: needs patch -> resolved |
| 2013年11月04日 09:47:21 | ncoghlan | set | title: Document and test codecs.encode and codecs.decode -> Document codecs.encode and codecs.decode messages: + msg202101 versions: - Python 3.3, Python 3.4 |
| 2013年11月04日 09:31:43 | ncoghlan | set | title: Document codecs.encode and codecs.decode -> Document and test codecs.encode and codecs.decode versions: + Python 3.3, Python 3.4 |
| 2013年11月04日 09:28:17 | ncoghlan | set | files:
+ issue17827_docs_py27.diff messages: + msg202099 |
| 2013年10月13日 15:05:57 | ncoghlan | set | messages:
+ msg199718 versions: - Python 3.3, Python 3.4 |
| 2013年10月13日 14:56:14 | python-dev | set | nosy:
+ python-dev messages: + msg199713 |
| 2013年10月02日 15:17:55 | ncoghlan | set | messages:
+ msg198848 versions: + Python 2.7, Python 3.3 |
| 2013年07月08日 07:17:25 | Grant | set | files:
+ 17827.diff versions: - Python 2.7, Python 3.3 nosy: + Grant messages: + msg192625 keywords: + patch |
| 2013年04月27日 15:21:34 | ncoghlan | set | messages: + msg187910 |
| 2013年04月26日 19:32:44 | tshepang | set | messages: + msg187871 |
| 2013年04月26日 17:51:46 | ezio.melotti | set | messages: + msg187867 |
| 2013年04月26日 17:38:50 | tshepang | set | nosy:
+ tshepang messages: + msg187866 |
| 2013年04月25日 13:54:08 | barry | set | nosy:
+ barry |
| 2013年04月25日 07:51:29 | ncoghlan | set | messages: + msg187765 |
| 2013年04月24日 14:23:57 | flox | set | nosy:
+ flox |
| 2013年04月24日 13:49:34 | ezio.melotti | set | keywords:
+ easy nosy: + ezio.melotti type: enhancement stage: needs patch |
| 2013年04月24日 13:45:40 | ncoghlan | create | |