py3k feature proposal: field auto-assignment in constructors

Torsten Bronger bronger at physik.rwth-aachen.de
Sun Jan 27 19:41:07 CET 2008


Hallöchen!

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
opinion.

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus
                                      Jabber ID: bronger at jabber.org
               (See http://ime.webhop.org for further contact info.)



More information about the Python-list mailing list