[issue1351] Add getsize() to io instances

2007-11-09 Thread Martin v. Löwis
Martin v. Löwis added the comment: Ok, I'm rejecting it now based on the YAGNI argument Guido brought up, and based on my own concerns. -- resolution: -> rejected status: open -> closed __ Tracker <[EMAIL PROTECTED]> __

[issue1351] Add getsize() to io instances

2007-11-09 Thread Christian Heimes
Christian Heimes added the comment: Does "it's convenient and I'm too lazy to address it in my code whenever the problem arises?" count as a darn good use case? No? Mh, I thought so :) __ Tracker <[EMAIL PROTECTED]> ___

[issue1351] Add getsize() to io instances

2007-11-08 Thread Guido van Rossum
Guido van Rossum added the comment: Sorry, I still don't like it. You'll have to come up with a darned good use case to justify this. __ Tracker <[EMAIL PROTECTED]> __

[issue1351] Add getsize() to io instances

2007-11-08 Thread Christian Heimes
Christian Heimes added the comment: > (a) the SizeInfo class is overkill. getsize() should just return an int. But I like overkill :) > (b) getsize() should check self.seekable() first and raise the appropriate error if the file isn't seekable. That's easy to implement > (c) os.fstat() is mu

[issue1351] Add getsize() to io instances

2007-10-29 Thread Guido van Rossum
Guido van Rossum added the comment: I'm -1 myself. I've rarely needed this -- if I wanted to know the size, I was almost always going to read the data into memory anyway, so why not just read it and then ask how much you got? For files on the filesystem there's os.path.getsize(). If I ever wer

[issue1351] Add getsize() to io instances

2007-10-28 Thread Christian Heimes
Christian Heimes added the comment: Martin v. Löwis wrote: > I'm skeptical: > > - If you add getsize, why not getlastchangeddate, getowner, getpermissions? getowner() etc. work only with file based streams and not with memory buffers. getsize() works with every concrete class in io.py > - in g

[issue1351] Add getsize() to io instances

2007-10-28 Thread Martin v. Löwis
Martin v. Löwis added the comment: I'm skeptical: - If you add getsize, why not getlastchangeddate, getowner, getpermissions? - in general, streams (which really is the interface for file-like objects) don't have the notion of "size"; only some do. - what is the purpose of the f.tell fragment?

[issue1351] Add getsize() to io instances

2007-10-28 Thread Christian Heimes
New submission from Christian Heimes: I always missed a getsize() method on file objects. The patch adds a method getsize() to all io instances. The method returns a SizeInfo object which can print a human readable name or the bare size in bytes. The method is using os.fstat and falls back to the