On Mon, Feb 14, 2011 at 3:20 PM, Wolfgang Rohdewald
<[email protected]>wrote:

>  On Montag 14 Februar 2011, Arve Knudsen wrote:
>
> > On Mon, Feb 14, 2011 at 2:17 PM, Sylvain Thénault <
>
> >
>
> > [email protected]> wrote:
>
> > > On 14 février 14:04, Arve Knudsen wrote:
>
> > > > > if the module is only imported here, then it's a bug.
>
> > > > > I don't reproduce this on a simple case though.
>
> > > >
>
> > > > Alright; I just installed the current pylint via pip (pip
>
> > > > install
>
> > >
>
> > > pylint). I
>
> > >
>
> > > > pasted my example code into 'tst.py' and ran pylint on it:
>
> > > >
>
> > > > -bash-3.00$ pylint tst.py
>
> > > > No config file found, using default configuration
>
> > > > ************* Module tst
>
> > > > C: 1: Missing docstring
>
> > > > W: 3:reimport: Reimport 'os' (imported line 1)
>
> > > > W: 3:reimport: Unused variable 'os'
>
> > >
>
> > > and os is not imported at module level, line 1 ?
>
> >
>
> > No, I copied the exact code from my first mail:
>
> >
>
> > def reimport():
>
> > """Test reimport"""
>
> > import os
>
> >
>
> >
>
> > Arve
>
>
> when I updated to 0.23 I interpreted this such that pylint
>
> does not analyze how often the function could be called so
>
> it assumes the worst.
>

Does it matter in practice how many times a module gets imported locally to
a function though? I find that in certain cases I have to defer importing of
certain modules until they are used, so it's not just a matter of style. I
don't think pylint should by default warn about local imports, that's just
way too strict unless there's some good reason I'm unaware of.

Arve
_______________________________________________
Python-Projects mailing list
[email protected]
http://lists.logilab.org/mailman/listinfo/python-projects

Reply via email to