The idea behind this message is for the sake of readability. We expect to find all the attributes an instance may have by reading its init method.
You may still want to split initialization into other methods though. In such case, you can simply assign attributes to None (with a bit of documentation) in the init then call the sub-initialization methods.
Instance attribute data defined outside __init__
猜你喜欢
转载自blog.csdn.net/weixin_42820516/article/details/88777824
今日推荐
周排行