[AstroPy] Coding Guidelines draft (comments encouraged)
Tue Aug 16 13:25:13 CDT 2011
On 08/16/2011 02:01 PM, James Turner wrote:
>>> I would change the coding guidelines read opposite of how they do
>>> currently: Use of super() should be encouraged except where one knows
>>> for sure that it's not going to be appropriate, due to the need for a
>>> customized method resolution order. What *should* be discouraged is the
>>> use of multiple inheritance except in the cases of orthogonal bases, or
>>> if one is really sure what they're doing.
>> You raise some very good points - my main concern was that it always
>> be consistently super() or consistently not . I can see that use of
>> super() would be a safer guideline given these use cases - does anyone
>> object to this?
> It's good to see these guidelines benefiting from everyone's experience
> -- my only comment would be to encourage good examples for those of us
> who are still a bit unsure exactly what super does and why :-).
> (I know it won't matter for simple cases that we're most likely to use.)
> BTW, I notice that the Python docs say super only works for new-style
> classes, so perhaps our guidelines should require those (I don't think
> they are part of PEP 8)?
Good points--I will see about adding an example to the documentation.
And yes, the guidelines should add that new-style classes are required
(for any new code that is--there are some classes in the Python stdlib
that are still not new-style, and nothing can be done about that).
Also, for Python 3 it's a non-issue.
Though it's meaningless until there's some actual code, it will be good
at some point to discuss Python 3. But I'd hold off on going any detail
on that until there's code to actually worry about porting.
More information about the AstroPy