Hacker News new | past | comments | ask | show | jobs | submit login

While I agree that _this_ is an extreme demonstration, metaclasses are powerful tool for developing dev-friendly Base classes/APIs in your libraries. Django models, for example, use metaclasses so the fields you define are more expressive while creating instances.



That's okay as long as the magic holds. If it starts to fail, you have to peek behind the curtain, and you lose yourself among the meta.


Django famously had a "magic removal" refactor before 1.0 as they collectively decided they had gone too far. They've since plotted a more conservative path but the ORM and similar magic was deemed reasonable.

I've found Django's metaclass usage pretty robust over the years. The curtain mostly remains unpeeked behind.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: