Title: bytes[0] != bytes[0:1]
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.6
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: geoffreyspear, ucyo
Priority: normal Keywords:

Created on 2018-09-26 11:43 by ucyo, last changed 2018-09-26 12:15 by ucyo. This issue is now closed.

Messages (3)
msg326446 - (view) Author: (ucyo) Date: 2018-09-26 11:43
bytes('sdf', 'UTF8')[0] != bytes('sdf', 'UTF8')[0:1]  # FALSE
'sdf'[0] != 'sdf'[0:1]  # TRUE

Is this a feature or bug. I would have expected the same behaviour.
msg326455 - (view) Author: Geoffrey Spear (geoffreyspear) * Date: 2018-09-26 12:11
Indexing bytes giving an int is a feature. Some might argue it's a bad feature, but it was done on purpose.
msg326456 - (view) Author: (ucyo) Date: 2018-09-26 12:15
Thank you for the answer.
Date User Action Args
2018-09-26 12:15:13ucyosetstatus: open -> closed
resolution: not a bug
messages: + msg326456

stage: resolved
2018-09-26 12:11:00geoffreyspearsetnosy: + geoffreyspear
messages: + msg326455
2018-09-26 11:43:34ucyocreate