[Python-Dev] Suggested addition to PEP 8 for context managers (original) (raw)

Nam Nguyen bitsink at gmail.com
Mon Apr 16 18:10:48 CEST 2012


On Mon, Apr 16, 2012 at 8:30 AM, Barry Warsaw <barry at python.org> wrote:

On Apr 15, 2012, at 01:13 PM, Raymond Hettinger wrote:

We should publish some advice on creating content managers. I agree, I'm just not sure PEP 8 is the right place for it. PEP 8 seems like it is structured more as mechanical guidelines for the look and feel of code, not so much for the semantic content of the code.  As such,

I'd like to piggyback this thread for a situtation to consider in PEP 8.

PEP 8 suggests no extra spaces after and before square brackets, and colons. So code like this is appropriate:

a_list[1:3]

But I find it less readable in the case of:

a_list[pos + 1:-1]

The colon is seemingly lost in the right.

Would it be better to read like below?

a_list[pos + 1 : -1]

Any opinion?

Nam



More information about the Python-Dev mailing list