This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Patrick Maupin
Recipients J Richard Snape, Patrick Maupin, brett.cannon, docs@python, eric.snow, flatsieve, ncoghlan
Date 2015-10-04.04:25:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1443932712.32.0.293585846769.issue25294@psf.upfronthosting.co.za>
In-reply-to
Content
I'm a big fan of stitching things together at the top myself -- maybe that's partly an unconscious reaction to this very issue.

But I'm not sanguine about how easy it is to express this practice in the docs.

This issue arose in the context of me answering a question on Stack Overflow.  My initial response was "well, duh, obviously relative imports are more Pythonic here because that's the obvious way to do it (that works)."

But then, of course, PEP 8 disagrees.

For that actual question on Stack Overflow, you would have to carefully define the scope of "executing" so that it was fully understood to include "subclassing a class defined in a peer module or submodule" -- because that's what was breaking.

Just as most people don't think of imports that can be placed in a DAG as circular, most people also don't think of subclassing as "executing."

But the Python interpreter sometimes vehemently disagrees in both cases.  I'm not surprised at its behavior, but I'm also not surprised that some people who haven't thought deeply about the behavior find it surprising.

I'm not fully convinced that this even can be documented in a way that renders observed behavior unsurprising in the general case, but I am convinced that doing so would require a lot of care.
History
Date User Action Args
2015-10-04 04:25:13Patrick Maupinsetrecipients: + Patrick Maupin, brett.cannon, ncoghlan, docs@python, eric.snow, flatsieve, J Richard Snape
2015-10-04 04:25:12Patrick Maupinsetmessageid: <1443932712.32.0.293585846769.issue25294@psf.upfronthosting.co.za>
2015-10-04 04:25:11Patrick Maupinlinkissue25294 messages
2015-10-04 04:25:06Patrick Maupincreate