On 17 January 2014 15:50, Eric V. Smith <eric at trueblade.com> wrote: > For #3, hopefully this "additional work" on the 3.x side would just be > to add, to each class where you already have a custom __format__ used > for b''.format(), code like: > > def __format_ascii__(self, fmt): > return self.__format__(fmt.decode()).encode('ascii') For me, the big cost would seem to be in the necessary documentation, explaining the new special method in the language reference, explaining the 2 different forms of format() in the built in types docs. And the conceptual overhead of another special method for people to be aware of. If I implement my own number subclass, do I need to implement __format_ascii__? My gut feeling is that we simply don't implement format() for bytes. I don't see sufficient benefit, if %-formatting is available. Paul.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4