syntactic sugar for filesystem access in Python
Delaney, Timothy
tdelaney at avaya.com
Thu Sep 28 18:47:45 EDT 2000
The main problem I see with the below suggestion is that it would *only*
work with domain names. You couldn't do the following ...
sock = internet.192.168.0.1['http']
However, this could be overcome by mapping
internet.www.python.org (I prefer this ordering)
to
internet['www.python.org']
via a DNS lookup. This could then be the general form for the lookup. It
would also be easier to code originally (only need to mess with __getitem__
rather than __getattr__).
> >> How about extending it to include the Internet? ;)
> >>
> >> # First initialize the Internet ;)
> >> internet = Internet()
>
> Better be careful you don't 'del internet' --- a lot of people will be
> upset ;)
>
> >> sock = internet.org.python.www['http']
> >>
> >> (although the bare sockets are probably not much fun, it
> might be slightly
> >> interesting if each "Address" object had method for
> higher-level access to
> >> protocols, e.g. something a la urllib.urlget(self.address).read()).
> >
> >Filesystem is cool and this is fabulous suggestion.
> >- What would it take to get it working?
> >- And where does this fit in with XML-RPC, SOAP and .NET ?
>
> I agree that it's a great suggestion. What would it take to get it
> working? Somebody figuring out a decent way to map URLs into Python
> namespace, and then implementing it --- probably not terribly tough,
> although perhaps more than my one page of code for the
> filesystem. How
More information about the Python-list
mailing list