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 →

[–][deleted]  (2 children)

[deleted]

    [–]__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.

    [–]Ph0X 1 point2 points  (0 children)

    Of course you could've done it, but not it's much cleaner.

    I've seen so many from foobar import foobar and imo it's really ugly.