[Numpy-discussion] Import patch

Charles R Harris charlesr.harris at gmail.com
Mon Apr 4 09:34:05 EDT 2011


On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes <
paul.anton.letnes at gmail.com> wrote:

> Hi.
>
> When looking at the loadtxt/savetxt tickets, I noticed that the 're' module
> is imported in an odd place. I therefore suggest that this import is moved
> to the top of the file, in order to gather these as much as possible. I find
> the code easier to read then. After all, there is no 'try / catch' or
> similar to check if the module exists. See patch below. I do not believe any
> tests or tickets are needed - correct me if I am wrong.
>
> Cheers,
> Paul.
>
>
> --- a/numpy/lib/npyio.py        Sat Apr 02 20:19:55 2011 -0600
> +++ b/numpy/lib/npyio.py        Sun Apr 03 12:30:02 2011 +0200
> @@ -6,6 +6,7 @@
>  import format
>  import sys
>  import os
> +import re
>  import sys
>  import itertools
>  import warnings
> @@ -956,7 +957,6 @@
>         if own_fh:
>             fh.close()
>
> -import re
>  def fromregex(file, regexp, dtype):
>     """
>     Construct an array from a text file, using regular expression parsing.


If you want to see a lot of other small things for cleanups, run pyflakes or
pylint on the files in numpy/lib

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20110404/8008056b/attachment.html>


More information about the NumPy-Discussion mailing list