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 2010年06月21日 14:46 by vdupras, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (3) | |||
|---|---|---|---|
| msg108272 - (view) | Author: Virgil Dupras (vdupras) (Python triager) | Date: 2010年06月21日 14:46 | |
If we run 2to3 on the following code: s = b' ' print s[0] == s we end up with this: s = b' ' print(s[0] == s) However, the first code, under python2 prints True while the converted code, under python3 prints False. Shouldn't 2to3 convert this code to: s = b' ' print s[0:1] == s instead? |
|||
| msg108273 - (view) | Author: Benjamin Peterson (benjamin.peterson) * (Python committer) | Date: 2010年06月21日 14:59 | |
2to3 can't guess which slices are from bytes. |
|||
| msg108633 - (view) | Author: Terry J. Reedy (terry.reedy) * (Python committer) | Date: 2010年06月25日 21:19 | |
Replacing string indexes with length-1 slices in the 2.x codebase, whether or not one one is running 2to3, seems to be a 'known' technique for Python3 portability and unicode-bytes inter-operability. (It was discussed this week on py-dev list .) But I do not see it mentioned in PyWiki, such as on http://wiki.python.org/moin/PortingPythonToPy3k |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:02 | admin | set | github: 53289 |
| 2010年06月25日 21:19:57 | terry.reedy | set | nosy:
+ terry.reedy messages: + msg108633 |
| 2010年06月21日 16:12:10 | eric.araujo | set | stage: resolved |
| 2010年06月21日 14:59:11 | benjamin.peterson | set | status: open -> closed nosy: + benjamin.peterson messages: + msg108273 resolution: wont fix |
| 2010年06月21日 14:46:13 | vdupras | create | |