[Python-ideas] Extending __format__ method in ipaddress

Ethan Furman ethan at stoneleaf.us
Wed Feb 14 21:59:10 EST 2018


On 02/14/2018 02:29 PM, Eric Osborne wrote:

> Nick Coghlan suggested I instead extend __format__, which is what the diffs in the current pull request do.  This
> allows a great deal more flexibility: the current code takes 'b', 'n', or 'x' types, as well as the '#' option and
> support for the '_' separator.  I realize now I didn't add 'o' but I certainly can for completeness.  I debated adding
> rfc1924 encoding for IPv6 addresses but decided it was entirely too silly.
>
> This is just a convenience function, but IMO fills a need.  Is this worth pursuing?

Seems like a good idea to me!

--
~Ethan~



More information about the Python-ideas mailing list