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 2015年02月15日 18:33 by serhiy.storchaka, last changed 2022年04月11日 14:58 by admin. This issue is now closed.
| Messages (8) | |||
|---|---|---|---|
| msg236057 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年02月15日 18:33 | |
The main motivation of PEP 461 was to help ease migration from, and/or have a single code base with, Python 2. But bytes formatting don't support the %r code supported in Python 2. Instead it supports the %a code which is exactly equivalent to the %r code in Python 2 but doesn't supported in Python 2. So it is not so easy to migrate from or have a single code base with Python 2 it the code uses the %r opcode. As far as bytes formatting supports the %s code (an alias to %b) purely for compatibility with Python 2, it would be good to support the %r as an alias to %a. |
|||
| msg236062 - (view) | Author: Guido van Rossum (gvanrossum) * (Python committer) | Date: 2015年02月15日 19:40 | |
Yeah, we probably got carried away by purity concerns. |
|||
| msg236063 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2015年02月15日 20:00 | |
"As far as bytes formatting supports the %s code (an alias to %b) purely for compatibility with Python 2, it would be good to support the %r as an alias to %a." I don't like this idea. |
|||
| msg236068 - (view) | Author: Ethan Furman (ethan.furman) * (Python committer) | Date: 2015年02月15日 20:28 | |
Sometimes practicality wins; it's why we allow %s, and we should also allow %r. Both %s and %r need to be clearly documented as an aid to Py2/3 code bases, and not recommended for new code. Serhiy, do you have time to take of this? |
|||
| msg236069 - (view) | Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) | Date: 2015年02月15日 21:00 | |
The implementation is easy -- just add "case 'r':" before "case 'a':". The hard (to me) part is the documentation, so that I'm out of the game. |
|||
| msg237874 - (view) | Author: Roundup Robot (python-dev) (Python triager) | Date: 2015年03月11日 15:17 | |
New changeset 611fa301b807 by Ethan Furman in branch 'default': Close issue23467: add %r compatibility to bytes and bytearray https://hg.python.org/cpython/rev/611fa301b807 |
|||
| msg237885 - (view) | Author: STINNER Victor (vstinner) * (Python committer) | Date: 2015年03月11日 16:31 | |
You should also update the PEP 461. |
|||
| msg238099 - (view) | Author: Ethan Furman (ethan.furman) * (Python committer) | Date: 2015年03月14日 19:49 | |
Added in https://hg.python.org/peps/rev/7fe79194a4f2 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:58:12 | admin | set | github: 67655 |
| 2015年03月14日 19:49:14 | ethan.furman | set | messages: + msg238099 |
| 2015年03月11日 16:31:11 | vstinner | set | messages: + msg237885 |
| 2015年03月11日 15:17:31 | python-dev | set | status: open -> closed nosy: + python-dev messages: + msg237874 resolution: fixed stage: resolved |
| 2015年02月16日 16:24:11 | giampaolo.rodola | set | nosy:
+ giampaolo.rodola |
| 2015年02月15日 21:15:38 | ethan.furman | set | assignee: ethan.furman |
| 2015年02月15日 21:00:03 | serhiy.storchaka | set | messages: + msg236069 |
| 2015年02月15日 20:28:09 | ethan.furman | set | messages: + msg236068 |
| 2015年02月15日 20:00:42 | vstinner | set | nosy:
+ vstinner messages: + msg236063 |
| 2015年02月15日 19:40:24 | gvanrossum | set | messages: + msg236062 |
| 2015年02月15日 18:33:27 | serhiy.storchaka | create | |