Select to view content in your preferred language

PEP 8 style guide

955
1
05-11-2012 11:27 PM
DwayneHenderson
Emerging Contributor
Hi!

I've been asking for criticism on my arcpy scripts by experienced Python programmers, and they all say arcpy needs to adhere to the PEP 8 style guide. Is this likely to happen anytime soon?

Thanks!
Tags (2)
0 Kudos
1 Reply
JasonScheirer
Esri Alum
I presume this is in reference to the capitalization scheme of the arcpy APIs. In this regard, no. It would break all existing scripts. The scheme, while not PEP-8 compliant, acts as a bridge between the naming and capitalization scheme of older scripting APIs such as the old Dispatch object.

The rules are as follows:


  • All top-level functions and classes are CapitalizedLikeThis

  • All class methods and properties are capitalizedLikeThis

  • Constants are PRESENTED_AS_ALL_CAPS_STRINGS


As a long-time Python developer I appreciate the desire to follow PEP 8, but as the ArcGIS system is quite a bit larger and encompassing a lot more than just a single Python API, there are motivating factors that make more sense with a bit of compromise with regard to the rest of the stack. It has its own style guide that may not match 1:1 with PEP 8, but it does make sense in ArcGIS and arcpy is internally consistent in its naming.
0 Kudos