[Python-Dev] Dropping __init__.py requirement for subpackages

Thomas Wouters thomas at python.org
Thu Apr 27 01:10:44 CEST 2006


On 4/27/06, Guido van Rossum <guido at python.org> wrote:
>
> On 4/26/06, Thomas Wouters <thomas at python.org> wrote:
> >
> >
> > On 4/26/06, Guido van Rossum <guido at python.org> wrote:
> > > OK, forget it. I'll face the pitchforks.
> >
> >
> > Maybe this'll help:
> >
> > http://python.org/sf/1477281
> >
> > (You can call it 'oldtimer-repellant' if you want to use it to convince
> > people there isn't any *real* backward-compatibility issue.)
>
> I'd worry that it'll cause complaints when the warning is incorrect
> and a certain directory is being skipped intentionally. E.g. the
> "string" directory that someone had. Getting a warning like this can
> be just as upsetting to newbies!


I don't think getting a spurious warning is as upsetting as getting no
warning but the damned thing just not working. At least you have something
to google for. And the warning includes the original line of source that
triggered it *and* the directory (or directories) it's complaining about,
which is quite a lot of helpful hints.

The clashes with directories that aren't intended to be packages *and* a
module of the same name is imported, yes, that's a real problem. It's not
any worse than if we change package imports the way you originally proposed,
though, and I think the actual number of spurious errors is very small
(which self-respecting module still does 'import string', eh? :-) I don't
think the fix for such a warning is going to be non-trivial.

Where are the valid reasons?


Of course, I only consider *my* reasons to be valid, and mine weren't
knee-jerk or tool-related. I don't think Python should be going "Oh, what
you wanted wasn't possible, but I think I know what you wanted, let me do it
for you", first of all because it's not very Pythonic, and second of all
because it doesn't lower the learning curve, it just delays some upward
motion a little (meaning the curve may become steeper, later.) A clear
warning, on the other hand, can be a helpful nudge towards the 'a-HA'
moment.


> Then I implore you, please check in that patch (after adding error
> checking for PyErr_Warn() -- and of course after a2 hs been shipped),
> and damn the torpedoes.


Alrighty then. The list has about 12 hours to convince me (and you) that
it's a bad idea to generate that warning. I'll be asleep by the time the
trunk un-freezes, and I have a string of early meetings tomorrow. I'll get
to it somewhere in the afternoon :)

--
Thomas Wouters <thomas at python.org>

Hi! I'm a .signature virus! copy me into your .signature file to help me
spread!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20060427/dbfc16b1/attachment.html 


More information about the Python-Dev mailing list