py3k feature proposal: field auto-assignment in constructors

Wildemar Wildenburger lasses_weil at klapptsowieso.net
Sun Jan 27 13:16:25 EST 2008


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

/W



More information about the Python-list mailing list