py3k feature proposal: field auto-assignment in constructors
Torsten Bronger
bronger at physik.rwth-aachen.de
Mon Jan 28 02:04:05 EST 2008
Hallöchen!
Dustan writes:
> On Jan 27, 12:41 pm, Torsten Bronger <bron... at physik.rwth-aachen.de>
> wrote:
>
>> [...]
>>
>> 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.
Mostly, I write them in one or two lines, e.g.
def __init__(self, id, kind, person, feedname):
self.id, self.kind, self.person = id, kind, person
(Sometimes I break after the "=".) Still, I don't think that this
at-most-once-per-class use case justifies a special syntax (whether
within the current language or not) that everyone else has to learn,
too.
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