pep-8 vs. external interfaces?

Roy Smith roy at panix.com
Sun Jan 4 20:47:30 CET 2009


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.

Or, I could draw a line in the sand and say, "If it's a protocol
primitive, it stays as written.  Otherwise, it's pep-8".  That's a
little uglier because it's not always obvious to the user exactly
which names are protocol primitives and which are higher-level
operations.

I figure either way, somebody's going to complain that I did it
wrong :-)

I realize there's no single correct answer here.  I'm seeking input
from people who have faced this question before.  Which way did you
go?  In retrospect, was it the right decision?




More information about the Python-list mailing list