[issue32820] Add bits method to ipaddress

Eric Osborne report at bugs.python.org
Mon Feb 19 14:10:36 EST 2018


Eric Osborne <eric at notcom.com> added the comment:

I brought it up on python-ideas.  Since I've not been through this process
before - what happens now?  Do I wait for code review on github, or is
there more I need to do?

eric

On Tue, Feb 13, 2018 at 11:56 PM Nick Coghlan <report at bugs.python.org>
wrote:

>
> Nick Coghlan <ncoghlan at gmail.com> added the comment:
>
> Aye, definitely worth a thread on python-ideas. My rationale for
> suggesting something based on the built-in numeric codes is that it makes
> it straightforward for *users* to transfer knowledge from that
> mini-language.
>
> As far as parsing goes, I was thinking of something along the lines of the
> following naive approach:
>
>     typechar = fmt[-1:]
>     if not typechar or typechar not in ("b", "n", "x"):
>         return super().__format__(fmt)
>     prefix, group_sep, suffix = fmt[:-1].rpartition("_")
>     if prefix and prefix != "#" or suffix:
>         return super().__format__(fmt)
>     field_width = self._calculate_field_width(typechar)
>     return format(int(self),
> f"{prefix}0{field_width}{group_sep}{type_char}")
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <https://bugs.python.org/issue32820>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32820>
_______________________________________


More information about the Python-bugs-list mailing list