Good programming style

George Sakkis george.sakkis at gmail.com
Mon Sep 15 16:41:35 CEST 2008


On Sep 14, 9:07 pm, Grant Edwards <gra... at visi.com> wrote:
> On 2008-09-15, Adelle Hartley <ade... at akemi.com.au> wrote:
>
> > Grant Edwards wrote:
>
> >> When packages as significant as wxPython use naming
> >> conventions other than PEP 8, I find it hard to make a case
> >> that the PEP 8 naming convention is any better than any other.
>
> > This relates to a question I was thinking about...
>
> > I'm looking at porting a library that was written for COM and
> > .Net to work as a Python module, and was wondering whether it
> > would be better to stick to the library's current naming
> > convention so that the API is as similar as possible on each
> > platform, or to adopt a "when in Rome..." policy and follow
> > the "most mainstream" naming pattern for each
> > platform/language.
>
> If all that is would change is naming, then my advice would be
> to keep the existing naming.  That way it matches existing
> documentation and examples.  But, it does violate PEP 8.
>
> If the API itself is going to be changed significantly so that
> it's unique to the Python port (different to the point where
> existing documentation and examples are no longer useful), then
> using standard PEP 8 naming conventions is probably a good choice.

+1. Another factor is whether the original library's API is reasonably
stable or it's expected to change significantly in the future. In the
former case you may want to provide a more pythonic API, otherwise
you'll have to do more work to keep in sync two separate APIs with
every new version.

George




More information about the Python-list mailing list