py3k feature proposal: field auto-assignment in constructors

Dustan DustanGroups at gmail.com
Sun Jan 27 18:26:19 EST 2008


On Jan 27, 12:41 pm, Torsten Bronger <bron... at physik.rwth-aachen.de>
wrote:
> 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.

Are you referring to the alternate syntax or to the decorator? Either
way, you could be saving 4 or 5 or more lines, if you have enough
arguments.



More information about the Python-list mailing list