You can not achieve what you ask for in the way that you want, the idea of implicit self has been discussed and discarded by the python community.
However, concerning your code example, you can reduce the amount of code:
class range(tuple):
def print_range(self):
print("%x %x" % self)
Still, that code is bad, because adding a print_range() function is the wrong approach (why is it called print_range() and not print(), btw?). Instead, provide implementations of __str__() and __repr__() to format the object.
Some more notes:
- There is a
namedtuple() function that creates a type similar to a tuple, which you should perhaps take a look at.
- Calling the object
self is a convention, you can name it anything you like. Others won't easily be able to read your code though.
- Concerning style, check out PEP 8. There is a bunch of conventions that you should adhere to, unless you have a good reason not to.
__get__of methods. It's stupid and helps nothing, but it's not like it's impossible.