py3k feature proposal: field auto-assignment in constructors

Torsten Bronger bronger at
Sun Jan 27 19:41:07 CET 2008


Wildemar Wildenburger writes:

> André wrote:
>> Personally, I like the idea you suggest, with the modification
>> that I would use "." instead of "@", as in
>> class Server(object):
>>     def __init__(self, .host, .port, .protocol, .bufsize, .timeout):
>>         pass
> I like :)
> However, you can probably cook up a decorator for this (not
> certain, I'm not a decorator Guru), which is not that much worse.
> Still, I'd support that syntax (and the general idea.).

Well, you save one or two lines per class.  Not enough in my


Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: bronger at
               (See for further contact info.)

More information about the Python-list mailing list