
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.

On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes < paul.anton.letnes@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

On 4. apr. 2011, at 15.34, Charles R Harris wrote:
On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes <paul.anton.letnes@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 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Are you suggesting that I should do this and submit one or more patches? By the way - what is a suggested form of submitting patches? Using e-mail seems a bit clumsy to me. Paul.

On Mon, Apr 4, 2011 at 8:29 AM, Paul Anton Letnes < paul.anton.letnes@gmail.com> wrote:
On 4. apr. 2011, at 15.34, Charles R Harris wrote:
On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes <
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
paul.anton.letnes@gmail.com> wrote: 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 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Are you suggesting that I should do this and submit one or more patches?
That would be great, and a good way to get into numpy development.
By the way - what is a suggested form of submitting patches? Using e-mail seems a bit clumsy to me.
The best thing would be to setup to do your work on github and then issue pull requests, see the directions here: http://docs.scipy.org/doc/numpy/dev/gitwash/development_setup.html. If you are on linux or mac getting set up should be pretty easy. Windows may be trickier, I don't have experience doing development on that platform. Chuck

On 4. apr. 2011, at 16.42, Charles R Harris wrote:
On Mon, Apr 4, 2011 at 8:29 AM, Paul Anton Letnes <paul.anton.letnes@gmail.com> wrote:
On 4. apr. 2011, at 15.34, Charles R Harris wrote:
On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes <paul.anton.letnes@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 _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Are you suggesting that I should do this and submit one or more patches?
That would be great, and a good way to get into numpy development.
By the way - what is a suggested form of submitting patches? Using e-mail seems a bit clumsy to me.
The best thing would be to setup to do your work on github and then issue pull requests, see the directions here: http://docs.scipy.org/doc/numpy/dev/gitwash/development_setup.html. If you are on linux or mac getting set up should be pretty easy. Windows may be trickier, I don't have experience doing development on that platform.
I'm on a mac, and I've got git. The skills to use it will have to grow with time. I submitted a pull request on this particular patch - let me know if I got it right! Cheers, Paul.

On Mon, Apr 4, 2011 at 8:57 AM, Paul Anton Letnes < paul.anton.letnes@gmail.com> wrote:
On 4. apr. 2011, at 16.42, Charles R Harris wrote:
On Mon, Apr 4, 2011 at 8:29 AM, Paul Anton Letnes <
paul.anton.letnes@gmail.com> wrote:
On 4. apr. 2011, at 15.34, Charles R Harris wrote:
On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes <
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
If you want to see a lot of other small things for cleanups, run
Chuck _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Are you suggesting that I should do this and submit one or more patches?
That would be great, and a good way to get into numpy development.
By the way - what is a suggested form of submitting patches? Using e-mail seems a bit clumsy to me.
The best thing would be to setup to do your work on github and then issue
paul.anton.letnes@gmail.com> wrote: parsing. pyflakes or pylint on the files in numpy/lib pull requests, see the directions here: http://docs.scipy.org/doc/numpy/dev/gitwash/development_setup.html. If you are on linux or mac getting set up should be pretty easy. Windows may be trickier, I don't have experience doing development on that platform.
I'm on a mac, and I've got git. The skills to use it will have to grow with time.
I submitted a pull request on this particular patch - let me know if I got it right!
Looked good, I went ahead and applied it. Mind, we aren't always so responsive ;) Chuck

On Mon, Apr 4, 2011 at 9:33 AM, Charles R Harris <charlesr.harris@gmail.com>wrote:
On Mon, Apr 4, 2011 at 8:57 AM, Paul Anton Letnes < paul.anton.letnes@gmail.com> wrote:
On 4. apr. 2011, at 16.42, Charles R Harris wrote:
On Mon, Apr 4, 2011 at 8:29 AM, Paul Anton Letnes <
paul.anton.letnes@gmail.com> wrote:
On 4. apr. 2011, at 15.34, Charles R Harris wrote:
On Sun, Apr 3, 2011 at 4:35 AM, Paul Anton Letnes <
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
If you want to see a lot of other small things for cleanups, run
Chuck _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion
Are you suggesting that I should do this and submit one or more patches?
That would be great, and a good way to get into numpy development.
By the way - what is a suggested form of submitting patches? Using e-mail seems a bit clumsy to me.
The best thing would be to setup to do your work on github and then issue pull requests, see the directions here: http://docs.scipy.org/doc/numpy/dev/gitwash/development_setup.html. If you are on linux or mac getting set up should be pretty easy. Windows may be
paul.anton.letnes@gmail.com> wrote: parsing. pyflakes or pylint on the files in numpy/lib trickier, I don't have experience doing development on that platform.
I'm on a mac, and I've got git. The skills to use it will have to grow with time.
I submitted a pull request on this particular patch - let me know if I got it right!
Looked good, I went ahead and applied it. Mind, we aren't always so responsive ;)
One other thing, you should do even the trivial stuff in a branch, keeping the master branch of your numpy fork updated from the numpy repository directly. That way your diffs will based on numpy instead of your own fork. Chuck
participants (2)
-
Charles R Harris
-
Paul Anton Letnes