py3k feature proposal: field auto-assignment in constructors

Russ P. Russ.Paielli at gmail.com
Sun Jan 27 21:50:56 EST 2008


On Jan 27, 5:13 pm, Wildemar Wildenburger
<lasses_w... at klapptsowieso.net> wrote:
> Ben Finney wrote:
> > "André" <andre.robe... at gmail.com> writes:
>
> >> 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
>
> > -1.
>
> > That leading dot is too easy to miss when looking over the code.
>
> class Server(object):
>      def __init__(self, self.host, self.port,
>                   self.protocol, self.bufsize, self.timeout):
>          pass
>
> ?
>
> /W

That makes sense to me.

Come to think of it, why restrict this convention to the constructor?
Or am I just opening a can of worms?





More information about the Python-list mailing list