[Python-Dev] Python 3.x and bytes (original) (raw)

Ethan Furman ethan at stoneleaf.us
Sun Jun 12 19🔞24 CEST 2011


Guido van Rossum wrote:

On Thu, May 19, 2011 at 1:43 AM, Nick Coghlan wrote:

Proposals to address this include: - introduce a "character" literal to allow c'a' as an alternative to ord('a') -1; the result is not a character but an integer. I'm personally favoring using b'a'[0] and possibly hiding this in a constant definition.

Using this method, my code now looks like:

constants

EOH = b'\r'[0] CHAR = b'C'[0] DATE = b'D'[0] FLOAT = b'F'[0] INT = b'I'[0] LOGICAL = b'L'[0] MEMO = b'M'[0] NUMBER = b'N'[0]

This is not beautiful code.

Ethan



More information about the Python-Dev mailing list