On Mon, 24 Feb 2014 08:54:08 +1000 Nick Coghlan <ncoghlan at gmail.com> wrote: > > > The idea being if we offer %a, folks won't be tempted to abuse > __bytes__. > > > > Which folks are we talking about? This sounds gratuitous. > > It's a harm containment tactic, based on the assumption people *will* want > to include the output of ascii() in binary protocols containing ASCII > segments But why would they? ascii() doesn't do what they want, since it's repr()-like, not str()-like. It seems your assumption is wrong. > By contrast, if %a doesn't exist, then it becomes more attractive to use %s > in the format string and define an ASCII assuming __bytes__ implementation > on a custom type. Uh... Few Python programmers would actually think of writing a __bytes__ method just to enable bytes interpolation for their custom types. However, adding "%a" as a supported interpolation format just makes things confusing for *everyone*. Regards Antoine.
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