On Thu, Feb 17, 2011 at 9:53 AM, Sylvain Thénault < [email protected]> wrote:
> On 17 février 09:51, Arve Knudsen wrote: > > While this is a sound guideline, it should not be applied with religious > > zeal. In contrast to a purely stylistic matter such as the naming of > > classes/variables etc., local imports can be motivated by technical > > concerns. When you perform local imports, it does not only affect the > > program's readability, but also its *behaviour*. I will in the general > case > > import globally at the beginning of my modules, but in certain cases I > want > > to defer module loading, maybe depending on a user option, and delegate > it > > to a function. Therefore, I think pylint (for instance) should leave this > to > > the programmer's discretion, and not try to be too smart about it. It's > > complicated enough in my experience to define style rules that don't get > too > > much in your way, in real life applications. > > That is expected pylint behaviour, for now. And I personnaly don't wish to > change it. Though we could add a special warning message for 'local' > imports > (fairly easy to implement). If someone wish this behaviour, he can file a > ticket :) I'd prefer to see it as off by default at least (please), were it to be added, the way gcc doesn't get too fascist about things until you specify -Wall :) My code is riddled enough with pylint suppressions where it happens to do the wrong thing, I find. Arve
_______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
