Metaprogramming Example

andrew cooke andrew at acooke.org
Thu Apr 17 14:25:33 CEST 2008


On Apr 17, 7:12 am, "bruno.desthuilli... at gmail.com"
<bruno.desthuilli... at gmail.com> wrote:
[...]

Thanks very much!

These are useful pointers.  I'll update my code accordingly.

At one point you pointed out I didn't need parentheses and I agree - I
was using them to avoid having a line continuation backslash (I think
I read to do that in a style guide recently).

One other question.  I had "foo is False" and you said I need
equality, which is a good point.  However, in any other language "not
foo" would be preferable.  I was surprised you didn't suggest that
(and I'm unsure now why I didn't write it that way myself).  Is there
some common Python standard that prefers "foo == False" to "not foo"?

Thanks,
Andrew

PS Is there anywhere that explains why Decorators (in the context of
functions/methods) are so good?  I've read lots of things saying they
are good, but no real justification of why.  To me it looks more like
"re-arranging deck chairs on the Titanic" - you're just moving where
the hack happens from one place to another.  Is the point that now the
hack is more visible and hence modifiable?



More information about the Python-list mailing list