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

> Python allows you to get pretty creative with the code you’re writing. For instance, you can:

> Use MetaClasses to self-register classes upon code initialization

Avoid metaclasses....

> Swap out True and False

Not possible anymore

> Add functions to the list of built-in functions

What are the practical reasons?

> Overload operators via magic methods

Useful but also recommend don’t. I can see someone writting numpy would do that, but most applications don’t have a reason

Profile profile profile! Find the bottlenecks.




Django uses metaclasses quite nicely actually for the the Forms and Model definitions.


"Avoid metaclasses...."

Good luck finding a Python library that doesn't use metaclasses anywhere!





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

Search: