syntactic sugar for filesystem access in Python

Erwin S. Andreasen erwin at andreasen.com
Wed Sep 27 17:55:16 EDT 2000


On Tue, 26 Sep 2000 23:19:59 GMT, Kragen Sitaker <kragen at dnaco.net> wrote:
>It is with some trepidation that I post this; I'm not sure it's
>useful.  It provides some very simple filesystem-access functionality
>in a very simple way, but it will throw exceptions at surprising times
>if the filesystem changes underneath it.
>
>Still, it should be entertaining.

How about extending it to include the Internet? ;)

# First initialize the Internet ;)
internet = Internet()

# This would look up www.python.org then create a socket to the HTTP port on
# it

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()).

-- 
=======================================================================
<erwin at andreasen.com>           Herlev, Denmark       Software Designer
<URL:http://www.andreasen.org/>       <*>                LASAT Networks
=======================================================================



More information about the Python-list mailing list