John J Lee wrote:
> On Tue, 24 Jan 2006, Ian Bicking wrote:
> [...]
>
>>Losing .open() would make it much harder for anyone wanting to write,
>>say, a URI library that implements the Path API.
>
> [...]
>
> Why? Could you expand a bit?
>
> What's wrong with urlopen(filesystem_path_instance) ?
My example shows this more clearly I think:
def read_config(path):
text = path.open().read()
... do something ...
If I implement a URI object with an .open() method, then I can use it
with this function, even though read_config() was written with file
paths in mind. But without it that won't work:
def read_config(path):
text = open(path).read()
...
--
Ian Bicking / [EMAIL PROTECTED] / http://blog.ianbicking.org
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com