[Python-Dev] file() or open()?
Nick Bastin
nbastin at opnet.com
Wed Jul 7 06:55:53 CEST 2004
On Jul 7, 2004, at 12:51 AM, Mike Brown wrote:
> Nick Bastin wrote:
>> I could see a future where open() would support any valid URI
>
> -1.
>
> This already exists, mostly, in urllib.urlopen(), which happens to be
> very
> lenient in what it will accept as a "URL" to open. It attempts to
> guess at the
> intended behavior, regardless of whether the argument was a URI
> (possibly
> relative) or an OS path (possibly relative) or some hybrid of the two.
> Often
> it is impossible to tell based on syntax alone what type of
> thing-to-be-dreferenced the argument is, so the function errs on the
> side of
> what's most likely -- not that it goes to great lengths.
Keep in mind that I'm not actually suggesting that it *do* that, but
merely as an example that open() could have a different behaviour from
file().
--
Nick
More information about the Python-Dev
mailing list