Agreed that this could be achieved by a third party library; and probably
already is - but the ipaddress module in Python could also have been one.
Therefore I feel it would somewhat complete the already existing networking
utilities already included if we were to implement this within the standard
library. It is for this reason i also recommend an API that is familiar to
people who already use the ipaddress module; as this would be a layer 2
compliment to the existing package.

Happy to discuss,

Pete Wicken

On Sat, Apr 4, 2020 at 8:14 PM Christopher Barker <python...@gmail.com>
wrote:

> This is a perfect idea for a third party package to be put on PyPi. Have
> you looked to see if one exists already?
>
> If, at some point, there is a robust and mature version that is widely
> used, then it might be worth considering g for the standard library.
>
> -CHB
>
> On Sat, Apr 4, 2020 at 4:53 AM Pete Wicken <petewic...@gmail.com> wrote:
>
>> Currently in Python 3 we have an ipaddress module which allows easy
>> manipulation of IP version 4 and 6 addresses and networks. Examples of this
>> are getting the packed bytes representation of an address, checking if an
>> address is of a specific type according to the RFC (private, multicast,
>> etc.)
>>
>> My proposal is that we have something with a similar API for MAC
>> addresses. A lot of these operations that we have for IPv4 and IPv6
>> addresses are also applicable for MAC addresses. We can take in
>> concatenated, hyphenated or dotted notations.
>> Some of the methods could include
>> packed
>> is_multicast
>> is_broadcast
>> is_universal
>> get_oui
>>
>> and optionally format outputs
>>
>> dotted(upper=False)
>> hyphenated(upper=False)
>> concatenated(upper=False)
>>
>>
>> get_oui could initially just return the OUI part of the address without
>> resolving. However, it is possible that on build of Python we pull down the
>> latest OUIs from IEEE into a python file.
>>
>> My initial thought if people are in agreement was to have a macaddress.py
>> module. However if the APIs for these are similar enough, perhaps it
>> warrants having a networkaddress.py module that contains both the old
>> ipaddress code and the new macaddress code?
>>
>> I would be grateful to hear people's thoughts on this.
>>
>> Pete Wicken
>> _______________________________________________
>> Python-ideas mailing list -- python-ideas@python.org
>> To unsubscribe send an email to python-ideas-le...@python.org
>> https://mail.python.org/mailman3/lists/python-ideas.python.org/
>> Message archived at
>> https://mail.python.org/archives/list/python-ideas@python.org/message/GRCNHOEGNVTO2O5O4JKDCGFGR3MRHIAP/
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
> --
> Christopher Barker, PhD
>
> Python Language Consulting
>   - Teaching
>   - Scientific Software Development
>   - Desktop GUI and Web Development
>   - wxPython, numpy, scipy, Cython
>
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MYEWJAKKWCLHXZWQH23RJ54B6XCHOV7D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to