A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2014-January/131741.html below:

[Python-Dev] PEP 461 updates

[Python-Dev] PEP 461 updatesEthan Furman ethan at stoneleaf.us
Fri Jan 17 02:51:43 CET 2014
On 01/16/2014 05:32 PM, Greg wrote:
>
> I don't think it matters whether the internal details of that
> debate make sense to the rest of us. The main thing is that
> a consensus seems to have been reached on bytes formatting
> being basically a good thing.

And a good thing, too, on both counts!  :)

A few folks have suggested not implementing .format() on bytes;  I've been resistant, but then I remembered that format 
is also a function.

http://docs.python.org/3/library/functions.html?highlight=ascii#format
======================================================================
format(value[, format_spec])

     Convert a value to a “formatted” representation, as controlled by format_spec. The interpretation of format_spec 
will depend on the type of the value argument, however there is a standard formatting syntax that is used by most 
built-in types: Format Specification Mini-Language.

     The default format_spec is an empty string which usually gives the same effect as calling str(value).

     A call to format(value, format_spec) is translated to type(value).__format__(format_spec) which bypasses the 
instance dictionary when searching for the value’s __format__() method. A TypeError exception is raised if the method is 
not found or if either the format_spec or the return value are not strings.
======================================================================

Given that, I can relent on .format and just go with .__mod__ .  A low-level service for a low-level protocol, what?  ;)

--
~Ethan~
More information about the Python-Dev mailing list

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