Giovanni Bajo wrote:
> Greg Ewing <[EMAIL PROTECTED]> 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.
Cheers,
Nick.
--
Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia
---------------------------------------------------------------
http://www.boredomandlaziness.org
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com