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 2011年02月17日 16:46 by vstinner, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| patch | brendel, 2011年12月17日 17:20 | patch for docstring of bytes and bytesarray | review | |
| Messages (7) | |||
|---|---|---|---|
| msg128739 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年02月17日 16:46 | |
There are 5 different usages of the bytes() constructor: 1) bytes(iterable_of_ints) -> bytes 2) bytes(string, encoding[, errors]) -> bytes 3) bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer 4) bytes(memory_view) -> bytes 5) bytes(int) <=> b'0円' * size The docstring describes the four first usages, the documentation only (3). http://docs.python.org/dev/library/functions.html#bytes Note: bytes(3) accepts 2 other arguments, but I don't think that they are used: bytes(3, 'unused encoding', 'unused errors'). |
|||
| msg128740 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年02月17日 16:52 | |
> 3) bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer > 4) bytes(memory_view) -> bytes These are AFAIR the same. |
|||
| msg128741 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年02月17日 16:55 | |
> These are AFAIR the same. So the docstring should also maybe be updated too: $ python >>> help(bytes) Help on class bytes in module builtins: class bytes(object) | bytes(iterable_of_ints) -> bytes | bytes(string, encoding[, errors]) -> bytes | bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer | bytes(memory_view) -> bytes | | Construct an immutable array of bytes from: | - an iterable yielding integers in range(256) | - a text string encoded using the specified encoding | - a bytes or a buffer object | - any object implementing the buffer API. | ... |
|||
| msg128811 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2011年02月18日 20:00 | |
You sort of left out bytes() == bytes(0) == b''. I did not know about case 5 -- not surprisingly ;-). |
|||
| msg149670 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2011年12月17日 15:29 | |
Oooh, I missed the important sentence "Accordingly, constructor arguments are interpreted as for bytearray()." The 5 constructors are documented in bytearray doc: http://docs.python.org/dev/library/functions.html#bytearray |
|||
| msg149679 - (view) | Author: (brendel) | Date: 2011年12月17日 17:09 | |
Here is a patch for the docstring of bytes and bytesarray. |
|||
| msg149712 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2011年12月17日 22:16 | |
New changeset beac7d6c7be4 by Victor Stinner in branch '3.2': Issue #11231: Fix bytes and bytearray docstrings http://hg.python.org/cpython/rev/beac7d6c7be4 New changeset dc670add1e28 by Victor Stinner in branch 'default': Issue #11231: Fix bytes and bytearray docstrings http://hg.python.org/cpython/rev/dc670add1e28 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:13 | admin | set | github: 55440 |
| 2012年03月30日 21:45:07 | r.david.murray | link | issue11310 superseder |
| 2011年12月17日 22:16:57 | python-dev | set | nosy:
+ python-dev messages: + msg149712 |
| 2011年12月17日 17:20:56 | brendel | set | files: + patch |
| 2011年12月17日 17:17:58 | brendel | set | files: - patch |
| 2011年12月17日 17:09:05 | brendel | set | files:
+ patch nosy: + brendel messages: + msg149679 |
| 2011年12月17日 15:29:43 | vstinner | set | status: open -> closed resolution: works for me messages: + msg149670 |
| 2011年02月18日 20:00:25 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg128811 |
| 2011年02月18日 19:35:25 | eric.araujo | set | nosy:
+ eric.araujo |
| 2011年02月17日 16:55:39 | vstinner | set | nosy:
pitrou, vstinner, docs@python messages: + msg128741 |
| 2011年02月17日 16:52:17 | pitrou | set | nosy:
+ pitrou messages: + msg128740 |
| 2011年02月17日 16:46:43 | vstinner | create | |