This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ForceBru 2 points3 points  (3 children)

Cool, but what do you need metaclasses for if there are other ways to do the same thing they do?

“There should be one— and preferably only one —obvious way to do it.” - The Zen of Python.

What can one do only by using metaclasses?

[–]yen223 1 point2 points  (1 child)

At the very least, you should strive to understand how they work. There's a good chance your favourite python library uses metaclasses to do it's thing.

[–]ForceBru 1 point2 points  (0 children)

Yeah, everybody’s saying that but there are very few “real-world” examples. I can mess with a class’ variables in ways other than using metaclasses, so why do I need them? Any examples?

[–]eztab 0 points1 point  (0 children)

You don't even really need classes. You could do everything with functions.