[Baypiggies] PEP-8 Style Interpretation Question

jim jim at well.com
Tue May 27 06:51:26 CEST 2008


what about ## for the case of 
zip_codes = [ 
##	94001, 
	94002, 
##	94003 
# 	... 
	] 



On Mon, 2008-05-26 at 20:25 -0700, Drew Perttula wrote:
> 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 = [
>      94001,
>      94002,
>      94003,
>      94004,
>      ]
> 
> 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,
>      94002,
> #    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.
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies
> 



More information about the Baypiggies mailing list