Deprecation Warning:

  本人使用的Python 版本是目前最新的3.7版。在学Python的迭代器这一章,看到Python可以用 isinstance() 来判断一个对象是否为Iterator 对象。

from collections import Iterator
print(isinstance((x for x in range(9)), Iterator)

结果出是True , 但是出现了一个Warning :

Deprecation Warning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working from collections import Iterator

True

这里如果是最新版本,都会出现这样一个警告!但是没什么影响。按照警告的意思,3.8版会更新另外一种用法



猜你喜欢

转载自blog.csdn.net/jobbaba/article/details/80884844