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 <[email protected]> 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 -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/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 -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/22FYBMNA7P7N6VS54SYMARYHWL76VSD7/ Code of Conduct: http://python.org/psf/codeofconduct/
