__autoinit__ (Was: Proposal: reducing self.x=x; self.y=y; self.z=z boilerplate code)
Reinhold Birkenfeld
reinhold-birkenfeld-nospam at wolke7.net
Mon Jul 11 09:37:35 EDT 2005
Dan Sommers wrote:
> Without thinking it all the way through, I suppose these:
>
> def method_1(self, *self.l):
> pass
> def method_2(self, **self.d):
> pass
>
> could act as if they were these:
>
> def method_1(self, *args):
> self.l = args
> del args
> def method_2(self, **kw):
> self.d = kw
> del kw
I still think it's too specialized. What would, hypothetically, this do?
class Bar: pass
class Foo:
x = Bar()
def method_1(self, x.y):
pass
It's hard to explain that you can autoassign self.y but not x.y.
Reinhold
More information about the Python-list
mailing list