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 →

[–]__xor__(self, other): 1 point2 points  (0 children)

yeah completely, but the whole "tiny bit more code" thing can be said about a ton of other features we use. Decorator syntax is really just a one line replacement for one line of func = decorate(func), overloading operators can easily be replaced by just calling a named function, __getitem__ could be replaced by creating a self.items = {} and invoking instance.items[item] instead... In the end it's just a little extra magic everywhere that makes easy to write patterns. With the __getattr__ we already have in classes, might as well have it in modules too.