IPy模块使用IP计算子网报错思考

我也遇到了这个问题有一些思考不知道对不对,就是这个模块你想使用的时候必须要使用网络号加上掩码的形式,不能取其中的ip地址来计算,不然会报错,例如:

ip = IP('172.16.0.1/16')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/anaconda3/lib/python3.7/site-packages/IPy.py", line 260, in init
raise ValueError("%s has invalid prefix length (%s)" % (repr(self), self._prefixlen))
ValueError: IP('172.16.0.1/16') has invalid prefix length (16)
这样就会报错,如果使用下面:
ip = IP('172.16.0.0/16')

就不会报错,所以我是这么想的,不知道对不对,这算不算这个模块的一个弊端