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.


On Sat, Apr 4, 2020 at 4:53 AM Pete Wicken <> 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

and optionally format outputs


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 module. However if the APIs for these are similar enough, perhaps it warrants having a 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 --
To unsubscribe send an email to
Message archived at
Code of Conduct:
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython