pep-8 vs. external interfaces?
Philip Semanchuk
philip at semanchuk.com
Tue Jan 6 16:21:07 EST 2009
On Jan 4, 2009, at 2:47 PM, Roy Smith wrote:
> I'm building a Python language wrapper to an network protocol which
> traditionally uses camelCase function names. I'm trying to make the
> new code pep-8 compliant, which means function names should be written
> this_way() instead of thisWay(). I've got a couple of choices open to
> me.
>
> I could convert all the protocol names to pep-8 style mechanically.
> This is not as much work as it seems; the lowest-level Python code is
> already machine generated from a tabular description of the protocol.
> It's about one more line of code to convert getLibraries() to
> get_libraries(). This will leave the result the cleanest from the
> Python point of view. It'll also make the Python binding look a
> little different from the C++, Java, Perl, etc, bindings.
+1 for PEP 8 compliance. Programmers unfamiliar with the existing
protocol will appreciate its Pythonic feel instead of wondering why
the names are all "wrong". Those familiar with the existing protocol
will have to make a mental adjustment, but at least they'll be
adjusting to a target (standard Python style) that they presumably know.
> I figure either way, somebody's going to complain that I did it
> wrong :-)
I promise to be the first to complain no matter what you choose. ;)
Good luck
Philip
More information about the Python-list
mailing list