Getting rid of "self."

Nick Coghlan ncoghlan at
Fri Jan 7 16:20:31 CET 2005

BJörn Lindqvist wrote:
> So I'm asking here if someone
> knows a better way, maybe using decorators or metaclasses or other
> black magic?

Wait for Python 3k when this will work:

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


Nick Coghlan   |   ncoghlan at   |   Brisbane, Australia

More information about the Python-list mailing list