[Baypiggies] PEP-8 Style Interpretation Question

Drew Perttula drewp at bigasterisk.com
Tue May 27 05:25:10 CEST 2008

Matt Good wrote:
>> I could compromise to
>> def demo(
>>     first_attribute,
>>     second_attribute):
>>     print "spam"

Things are different if the items are equal peers. There's a practical 
advantage to the spaced-out style. Consider some list elements like this:

zip_codes = [

Since I've put each item on its own line and included the optional comma 
at the end, you can now easily switch on and off any combination of 
lines, e.g. for testing.

zip_codes = [
#    94001,
#    94003,
#    94004,

This style also makes it really easy to add more items to the end of the 
list, to reorder the items, etc. Omitting the last comma or putting the 
] after the 4 would make editing the code more awkward, and I don't 
think that was ever a goal of pep8.

More information about the Baypiggies mailing list