[Python-ideas] bytes indexing behavior

Steven D'Aprano steve at pearwood.info
Mon Jun 6 23:57:40 EDT 2016


On Mon, Jun 06, 2016 at 12:35:30PM -0700, Neil Schemenauer wrote:

> Maybe the following would work:
> 
> - add a new method to 'bytes' that returns a view object with the
>   current index/iteration behavior
>
> - enable a deprecation warning for code that uses indexing/iteration
>   on bytes
> 
> - when sufficient time has passed, revert to Python 2 behavior for
>   indexing/iteration

Sounds reasonable. That could even be a __future__ import, so that those 
without a big investment in the current behaviour could get the new 
behaviour straight away.


-- 
Steve


More information about the Python-ideas mailing list