← Back to team overview

launchpad-dev team mailing list archive

Re: New coding standard for formatting imports

 

On 2010-08-19 20:36, Guilherme Salgado wrote:

We would also lose the ability to use in-editor pyflakes to find
undefined names. It's true we wouldn't need it for missing imports
anymore, but that's not the only source of undefined names.

I love that feature of pyflakes, but frankly its main role in my life is to remind me of mechanical import makework that still needs doing.

It does help with other kinds of missing symbols, but that's almost a side effect of how it works:

#! /usr/bin/python
import sys
from datetime import dedent  # Hah!  FAIL.
for arg in sys.argv:
    print(dedent(arg))

Not a peep out of pyflakes there. All it gives us is a kind of "type new password again:" for python identifiers.

This is the same hoop we jumped through with C functions: you declare them, and then you declare them again when you define them, and then we have tools to help you ensure that you manually keep the two consistent. We used to think we needed that, we got rid of it, and I've never heard of anyone looking back with regret. Computers should be doing the boring mechanical jobs we tell them to. Not the other way around. :-)

I agree that it's nice to have immediate feedback about unknown symbols, but teaching pyflakes or the editor to follow up on "from foo import *" could be a better solution.


Jeroen



References