A mistake which almost went me mad

Rob Gaddi rgaddi at highlandtechnology.invalid
Thu Mar 3 12:53:01 EST 2016


Oscar Benjamin wrote:

> On 3 March 2016 at 11:48, Tim Chase <python.list at tim.thechases.com> wrote:
>> On 2016-03-03 10:43, Nick Sarbicki wrote:
>>> The number of times I've had to correct a student for naming their
>>> script "turtle.py".
>>>
>>> And the number of times I've caught myself doing it...
>>
>> I'm surprised at the number of times I find myself creating an
>> "email.py" DESPITE KNOWING BETTER EVERY SINGLE TIME.
>
> This mistake is too easy to make and should be fixed in the language
> somehow. There's no way that a novice user can know which module names
> are implicitly "reserved" by being used somewhere in the stdlib or the
> collection of 3rd party modules that they may happen to have
> installed.
>

Inside of modules it is, under Python 3.  Inside of modules there's a
clear distinction of:
  import thingfromstdlib
  from . import thingfromlocal

A bit of a nuisance at first, but once you get used to it everything
just makes unambiguous sense.

The problem is that this same distinction doesn't get made for
"programs", only for "modules".  So, among other issues, you wind up
unable to run tests inside of module directories because the syntax
becomes wrong.

-- 
Rob Gaddi, Highland Technology -- www.highlandtechnology.com
Email address domain is currently out of order.  See above to fix.



More information about the Python-list mailing list