[Python-ideas] RFC: bytestring as a str representation [was: a new bytestring type?]

Mark Lawrence breamoreboy at yahoo.co.uk
Wed Jan 8 19:11:10 CET 2014


On 08/01/2014 17:57, Andrew Barnert wrote:
> On Jan 8, 2014, at 2:18, Mark Lawrence <breamoreboy at yahoo.co.uk> wrote:
>
>> On 08/01/2014 09:59, Nick Coghlan wrote:
>>>
>>> Now that your proposal has been better explained, yes, I agree that
>>> "asciibytes" and "asciistr" types would be well worth experimenting
>>> with. I mention both, since it's far from clear if a str subclass or a
>>> bytes subclass (or neither, although that may require bug fixes in
>>> CPython) would be more convenient for this use case.
>>
>> Could you subclass both to get the best of both worlds?  As in
>>
>> class asciixyz(str, bytes):
>
> You can't. (Try it,) More importantly, how would that work?

I haven't the faintest idea :)

>
> but rather in hopes that someone would have an answer that makes everything work.

The reason I threw this in in the first place.

-- 
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.

Mark Lawrence



More information about the Python-ideas mailing list