Getting rid of "self."

Luis M. Gonzalez luismgz at gmail.com
Fri Jan 7 11:10:14 EST 2005


You can do it easier now without any black magic:

class c:
def __init__(s):
s.x = 1
s.y = 2
s.hi = "Hi there!"

The word "self" is not mandatory. You can type anything you want
instead of self, as long as you supply a keyword in its place (it can
be "self", "s" or whatever you want).




More information about the Python-list mailing list