TypeError: object.__new__(int) is not safe, use int.__new__()

烈酒焚心 提交于 2019-12-05 15:41:29
Jon Clements

Put simply, prior to 2.6 - object.__new__ ignored arguments... Now it actually may do something with them... So the warning is that something different may happen.

This post Any ideas about the best work around for __new__ losing its arguments? - has a much more detailed explanation.

You probably also want to be looking at http://docs.python.org/library/functions.html#type

Knowing what's possible with all the meta stuff in Python is great, but just as a warning, I wouldn't get too hung up about it - as I've seen some really "clever" solutions, that are just monstrosities...

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!