[Python-3000] iostack, continued

Nick Coghlan ncoghlan at gmail.com
Wed Jun 7 15:32:45 CEST 2006

Giovanni Bajo wrote:
> Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>> I'm guessing he meant it shouldn't affect the state of anything
>> outside that object. But then we need to decide what counts
>> as part of the state of a file object. Does it include the
>> value of the file position of the underlying file descriptor?
>> If it does, then file.position = foo is a legitimate usage
>> of a property.
> I believe what he meant was that property change should not affect the state of
> anything but the *Python*'s object.

I believe the original context where the question came up was for Path objects 
- Guido (rightly) objected to touching the file system as a side effect of 
accessing the attributes of a conceptual object like a path string.

With a position attribute on actual file IO objects, it should be possible to 
set it up so that the file object only invokes tell() when you try to *change* 
the position. When you simply access the attribute, it will return the answer 
from an internal variable (it needs to do this anyway in order to take 
buffering into account).

And having attribute modification on a file object touch the file system 
really doesn't seem particularly unreasonable.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Python-3000 mailing list