[Python-Dev] PEP 292, Simpler String Substitutions

Fredrik Lundh fredrik@pythonware.com
Thu, 20 Jun 2002 12:52:26 +0200

christian wrote:

> > I usually mention "import" in the first hour (before methods),
> > and nobody has ever had any problem with that...
> Well, same here, but that might change, since the string
> module is nearly obsolete. You can show reasonably
> powerful stuff(*) without a single import.
> (*) and that's what you need to get people interested.

I usually start out with something web-oriented (which means
urllib).  how about adding a "get" method to strings?  or an "L"
prefix character that causes Python to wrap it up in a simple
URL container:

    print url"http://www.python.org".read()


but in practice, if you really want people to get interested,
make sure you have a domain-specific library installed on the
training machines.  why care about string fiddling when your
second python program (after print "hello world") can be:

    import noaa
    im = noaa.open("noaa16_20020620_1021")