Re: [Python-ideas] Syntax for making stuct / record / namedtuples

On 21 Oct 2009, at 16:56, Bruce Leban wrote:
I don't understand that last sentence.
I'm only half-joking. It's not obvious what that function parameter does and you don't give any examples of it's use.
I give two examples. One in the docstring (first example), the other one in the tests below the definition of the decorator (class Test2).
Just reading the code with unrelated assignments grouped together was confusing enough -- definitely not my coding style.
Sorry I confused you :)
More importantly not at all clear why this is better than
self.__dict__.update(locals())
It's not a very nice construct. And it doesn't work as is:
Probably not what was intended... So you can write something like:
But that reads even worse. Also, it's a bit more versatile. -- Arnaud

On Wed, Oct 21, 2009 at 10:19 AM, Arnaud Delobelle <arnodel@googlemail.com>wrote:
I meant there are no examples of using autoassign with a function.
Write once, read many times. :-) Especially for recipes, clear > concise.
I don't get the function case. And I have no idea what you mean by -> decorator or -> method. I do understand how the other two cases work but those first three lines of the doc don't tell me anything.
-- Arnaud

On Wed, Oct 21, 2009 at 10:19 AM, Arnaud Delobelle <arnodel@googlemail.com>wrote:
I meant there are no examples of using autoassign with a function.
Write once, read many times. :-) Especially for recipes, clear > concise.
I don't get the function case. And I have no idea what you mean by -> decorator or -> method. I do understand how the other two cases work but those first three lines of the doc don't tell me anything.
-- Arnaud
participants (2)
-
Arnaud Delobelle
-
Bruce Leban