Lisandro Dalcin wrote:
> On 2/27/08, Travis E. Oliphant <[EMAIL PROTECTED]> wrote:
>> Did this discussion resolve with a fix that can go in before 1.0.5 is
>> released?
>
> I believe the answer is yes, but we have to choose:
>
> 1- Use the regepx based solution of David.
A good idea, but a feat
On 2/27/08, Travis E. Oliphant <[EMAIL PROTECTED]> wrote:
> Did this discussion resolve with a fix that can go in before 1.0.5 is
> released?
I believe the answer is yes, but we have to choose:
1- Use the regepx based solution of David.
2- Move to use 'index' instead of 'find' as proposed by Al
On Thu, Feb 28, 2008 at 12:12 AM, Alan G Isaac <[EMAIL PROTECTED]> wrote:
> > On Wed, 27 Feb 2008, Robert Kern apparently wrote:
> >> Fixed in r4827.
>
>
>
> > On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker wrote:
> >> For the record, this is the fixed version:
> >> comment_start =
> On Wed, 27 Feb 2008, Robert Kern apparently wrote:
>> Fixed in r4827.
> On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker wrote:
>> For the record, this is the fixed version:
>> comment_start = line.find(comments)
>> if comment_start > 0:
>> line = line[:comments
On Wed, Feb 27, 2008 at 6:31 PM, Christopher Barker
<[EMAIL PROTECTED]> wrote:
> Robert Kern wrote:
> > Fixed in r4827.
>
> Thanks Robert. For the record, this is the fixed version:
>
> comment_start = line.find(comments)
> if comment_start > 0:
> line = line[:commen
Robert Kern wrote:
> Fixed in r4827.
Thanks Robert. For the record, this is the fixed version:
comment_start = line.find(comments)
if comment_start > 0:
line = line[:comments_start].strip()
else:
line = line.strip()
Just as a matter of interest
On Wed, Feb 27, 2008 at 4:04 PM, Travis E. Oliphant
<[EMAIL PROTECTED]> wrote:
> Did this discussion resolve with a fix that can go in before 1.0.5 is
> released?
Fixed in r4827.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible
Lisandro Dalcin wrote:
> Well, after all that said, I'm also fine with either approach. Anyway,
> I would say that my personal preference is for the one using
> 'str.index', as it is the simplest one regarding the old code.
>
> Like Christopher, I rarelly (never?) use 'loadtxt'. But this issue
> ma
Well, after all that said, I'm also fine with either approach. Anyway,
I would say that my personal preference is for the one using
'str.index', as it is the simplest one regarding the old code.
Like Christopher, I rarelly (never?) use 'loadtxt'. But this issue
made a coworker to get crazy (he is
David Huard wrote:
> The advantage of using regular expressions is that in this case it gives
> you some flexibility that wasn't there before. For instance, if for any
> reason there are two type of characters that coexist in the file to mark
> comments, using
> pattern = re.compile(comments)
>
Alan Isaac wrote:
Use index instead?
yup, that'll work. enclosed is another test file, with that and one
using string.split(comments) instead.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R(206) 526-6959 voice
7600 Sand Point Wa
On Wed, 27 Feb 2008, Christopher Barker wrote:
> The issue here is a result of what I consider a wart in python's string
> methods -- string.find() returns a valid index( -1 ) when
> it fails to find anything.
Use index instead?
Cheers,
Alan Isaac
__
Hi Christopher,
The advantage of using regular expressions is that in this case it gives you
some flexibility that wasn't there before. For instance, if for any reason
there are two type of characters that coexist in the file to mark comments,
using
pattern = re.compile(comments)
for i,line in en
David Huard wrote:
Would everyone be satisfied with a solution using regular expressions ?
Maybe it's because regular expressions make me itch, but I think it's
overkill for this.
The issue here is a result of what I consider a wart in python's string
methods -- string.find() returns a vali
Lisandro,
When you have some time, could you check this patch solves your problem (and
does not introduce new ones) ?
David
Index: numpy/lib/io.py
===
--- numpy/lib/io.py (revision 4824)
+++ numpy/lib/io.py (working copy)
@
I can look at it.
Would everyone be satisfied with a solution using regular expressions ?
That is, looking for the following pattern:
pattern = re.compile(r"""
^\s* # leading white space
(.*) # Data
%s? # Zero or one comment character
(.*) # Comments
\s*$ # Trailing white spa
On Tue, 26 Feb 2008, Lisandro Dalcin apparently wrote:
> I believe the current 'loadtxt' function is broken
I agree:
http://projects.scipy.org/pipermail/numpy-discussion/2007-November/030057.html>
Cheers,
Alan Isaac
___
Numpy-discussion mailing list
Dear all,
I believe the current 'loadtxt' function is broken if file does not
end in newline. The problem is at the last line of this fragment:
for i,line in enumerate(fh):
if ihttp://projects.scipy.org/mailman/listinfo/numpy-discussion
18 matches
Mail list logo