Why does Python 2.7 namedtuple implement __dict__?

前端 未结 1 703
梦如初夏
梦如初夏 2021-01-19 13:13

The namedtuple implementation in Python 2.7 implements __dict__. I\'m confused what this is doing; why do we need to make a special __dict__<

相关标签:
1条回答
  • 2021-01-19 13:32

    They just thought it would be convenient. Turns out it was more hassle than it was worth, causing issues with pickling and with subclasses, and it was conceptually confusing anyway. More recent Python versions don't have it any more.

    0 讨论(0)
提交回复
热议问题