On 15/01/2014 22:22, Brett Cannon wrote:



On Wed, Jan 15, 2014 at 5:00 PM, Steven D'Aprano <st...@pearwood.info
<mailto:st...@pearwood.info>> wrote:

    On Thu, Jan 16, 2014 at 10:55:31AM +1300, Greg Ewing wrote:
     > Neil Schemenauer wrote:
     > >Objects that implement __str__ can also implement __bytes__ if they
     > >can guarantee that ASCII characters are always returned,
     >
     > I think __ascii_ would be a better name. I'd expect
     > a method called __bytes__ on an int to return some
     > version of its binary value.

    +1


If we are going the route of a new magic method then __ascii__ or
__bytes_format__ get my vote as long as they only return bytes (I see no
need to abbreviate to __bformat__ or __formatb__ when we have method
names as long as __text_signature__ now).


__bytes_format__ gets my vote as it's blatantly obvious what it does. I'm against __ascii__ as I'd automatically associate that with ascii in the same way that I associate str with __str__ and repr with __repr__.

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

Mark Lawrence

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to