Understanding __init_subclass__

后端 未结 4 1569
甜味超标
甜味超标 2020-12-23 09:44

I finally upgraded my python version and I was discovering the new features added. Among other things, I was scratching my head around the new __init_subclass__ method. From

4条回答
  •  旧时难觅i
    2020-12-23 10:04

    I would like to add some references related to metaclasses and __init_subclass__ that may be helpful.

    Background

    __init_subclass__ was introduced as an alternative to creating metaclasses. Here is a 2-minute summary of PEP 487 in a talk by one of the core developers, Brett Cannon.

    Recommended References

    • Guido van Rossum's blog post on the early history of metaclasses in Python
    • Jake Vanderplas's blog post looking more deeply on implementing metaclasses

提交回复
热议问题