[issue1152248] Enhance file.readlines by making line separator selectable

2011-05-31 Thread John O'Connor
Changes by John O'Connor : -- nosy: +jcon ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-24 Thread Ralph Corderoy
Ralph Corderoy added the comment: fileLineIter() is not a solution that allows this bug to be closed, no. readline() needs modifying and if that means python-dev discussion then that's what it needs. Things to consider include changing the record separator as the file is read. $ printf 'a

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-22 Thread Nick Coghlan
Nick Coghlan added the comment: On Fri, Jul 23, 2010 at 3:54 AM, Antoine Pitrou wrote: > > Antoine Pitrou added the comment: > >> Personally, I think that this functionality should be built into >> Python's readlines. That's where a typical person would expect it to >> be, and this is somethin

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-22 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Personally, I think that this functionality should be built into > Python's readlines. That's where a typical person would expect it to > be, and this is something that is supported by most other scripting > language I've used. Adding it to readline() and/or

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-22 Thread Douglas Alan
Douglas Alan added the comment: Personally, I think that this functionality should be built into Python's readlines. That's where a typical person would expect it to be, and this is something that is supported by most other scripting language I've used. E.g., awk has the RS variable which let

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-22 Thread Ray.Allen
Ray.Allen added the comment: I think it's a good idea adding a keyword argument to specify the separator of readlines(). I believe most people can accept the universal meaning of "line", which has similar meaning of "record", that is a chunk data, maybe from using line separators other than

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-22 Thread Nick Coghlan
Nick Coghlan added the comment: A recipe in the comments on a tracker item isn't enough reason to close the RFE, no. An entry on the cookbook with a pointer from the docs might be sufficient, although I'm still not averse to the idea of an actual readrecords method (with appropriate tests).

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-21 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: This fileLineIter function looks like a good recipe to me. Can we close the issue then? -- nosy: +amaury.forgeotdarc resolution: -> works for me status: open -> pending ___ Python tracker

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-02 Thread Douglas Alan
Douglas Alan added the comment: Until this feature gets built into Python, you can use a Python-coded generator such as this one to accomplish the same effect: def fileLineIter(inputFile, inputNewline="\n", outputNewline=None, readSize=8192):

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-02 Thread Éric Araujo
Éric Araujo added the comment: Ralph, core developers have not rejected this idea. It needs a patch now (even rough) to get the discussion further. -- components: +Library (Lib) -Interpreter Core ___ Python tracker

[issue1152248] Enhance file.readlines by making line separator selectable

2010-07-01 Thread Ralph Corderoy
Ralph Corderoy added the comment: Google has led me here because I'm trying to see how to process find(1)'s -print0 output with Python. Perl's -0 option and $/ variable makes this trivial. find -name '*.orig' -print0 | perl -n0e unlink awk(1) has its RS, record separator, variable too.

[issue1152248] Enhance file.readlines by making line separator selectable

2010-04-13 Thread Éric Araujo
Changes by Éric Araujo : -- nosy: +merwok ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Douglas Alan
Douglas Alan added the comment: Antoine Pitrou wrote: > Nick Coghlan added the comment: > > Note that the problem with the read()+split() approach is that you > > either have to read the whole file into memory (which this RFE is trying > > to avoid) or you have to do your own buffering and

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: > Note that the problem with the read()+split() approach is that you > either have to read the whole file into memory (which this RFE is trying > to avoid) or you have to do your own buffering and so forth to split > records as you go. Since the latter is both d

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Nick Coghlan
Changes by Nick Coghlan : -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/o

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Nick Coghlan
Nick Coghlan added the comment: I agree with Antoine - given that the newlines parameter now deals with Skip's alternate line separator use case, a new method "readrecords" that takes a mandatory record separator makes more sense than using readlines to read things that are not lines. (of course

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Nick Coghlan
Nick Coghlan added the comment: I agree with Antoine - given that the newlines parameter now deals with Skip's alternate line separator use case, a new method "readrecords" that takes a mandatory record separator makes more sense than using readlines to read things that are not lines. (of course

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Ok, let me qualify my position a bit: - -1 for abusing the newline parameter - -1 for abusing readlines() - +0 on an additional method ("readchunks" was suggested) which does the splitting, either on a single character or on a string Please bear in mind the lat

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: Uh, trying again to remove the keyword :-( -- keywords: -easy ___ Python tracker ___ ___ Python-

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: And it's certainly not easy to do correctly :) -- ___ Python tracker ___ ___ Python-bugs-list mai

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Antoine Pitrou
Antoine Pitrou added the comment: -1 on this idea. readlines() exists precisely because line endings are special when it comes to text IO (because of the various platform differences). If you want to split on any character, you can just use read() followed by split(). No need to graft additiona

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread Nick Coghlan
Nick Coghlan added the comment: While RDM's quick test is encouraging, I think one of the key things is going to be developing tests for the various cases: - binary mode, single byte line ending - binary mode, multi-byte line ending - text mode, single byte single char line ending* - text mode,

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-15 Thread R. David Murray
R. David Murray added the comment: > cat temp this is$#a weird$#file$# > ./python Python 3.1b1+ (py3k:72632:72633M, May 15 2009, 05:11:27) [GCC 4.3.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> f = open('temp', newline='$#') [50354 refs] >>> f.readlines(

[issue1152248] Enhance file.readlines by making line separator selectable

2009-05-14 Thread Daniel Diniz
Changes by Daniel Diniz : -- components: +IO nosy: +benjamin.peterson, pitrou versions: +Python 3.2 -Python 3.1 ___ Python tracker ___ _

[issue1152248] Enhance file.readlines by making line separator selectable

2009-02-15 Thread Skip Montanaro
Changes by Skip Montanaro : -- nosy: -montanaro.historic ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: htt

[issue1152248] Enhance file.readlines by making line separator selectable

2009-02-15 Thread Nick Coghlan
Nick Coghlan added the comment: Any further work on this should wait until the io-in-c branch has landed (or at least be based on that branch). -- stage: test needed -> needs patch ___ Python tracker ___

[issue1152248] Enhance file.readlines by making line separator selectable

2009-02-15 Thread Daniel Diniz
Changes by Daniel Diniz : -- stage: -> test needed versions: +Python 3.1 -Python 3.0 ___ Python tracker ___ ___ Python-bugs-list ma

[issue1152248] Enhance file.readlines by making line separator selectable

2008-03-19 Thread Facundo Batista
Facundo Batista <[EMAIL PROTECTED]> added the comment: I took a look at it... It's not as not-complicated as I original thought. The way would be to adapt the Py_UniversalNewlineFread() function to *not* process the normal separators (like \n or \r), but the passed one. A critical point would

[issue1152248] Enhance file.readlines by making line separator selectable

2008-02-29 Thread Nick Coghlan
Nick Coghlan added the comment: The mail.python.org link I posted previously is broken. Here's an updated link to the relevant c.l.p. thread: http://mail.python.org/pipermail/python-list/2005-February/310020.html >From my point of view, I still think it's an excellent idea and would be happy to

[issue1152248] Enhance file.readlines by making line separator selectable

2008-02-27 Thread Facundo Batista
Facundo Batista added the comment: Sorry, I misunderstood you. I assign this to myself to give it a try. -- assignee: -> facundobatista _ Tracker <[EMAIL PROTECTED]> _

[issue1152248] Enhance file.readlines by making line separator selectable

2008-02-27 Thread Raymond Hettinger
Raymond Hettinger added the comment: For the record, I thought it was a reasonable request. AWK has a similar feature. The AWK book shows a number of example uses. Google's codesearch shows that the feature does get used in the field: http://www.google.com/codesearch?q=lang%3Aawk+RS&hl=en

[issue1152248] Enhance file.readlines by making line separator selectable

2008-02-26 Thread Facundo Batista
Facundo Batista added the comment: Raymond disapproved it, Skip discouraged it, and Nick didn't push it any more, all more than two years ago. Nick, please, if you feel this is worthwhile, raise the discussion in python-dev. -- nosy: +facundobatista resolution: -> rejected status: open