Built-ins vs. modules

Tim Peters tim_one at email.msn.com
Tue Apr 15 06:02:05 CEST 2003

[Paul Berkowitz]
> I see from the Python Library Reference (for 2.2) that a lot of
> things which I thought required a module to be imported can also be
> accessed without doing so:
>     >>> "boo".capitalize()   #built-in
>     'Boo'
>     >>> import string
>     >>> string.capitalize("boo")
>     'Boo'
> Why import the string module if you can do the same things anyway?

Nostalgia; inertia; laziness; perverseness; whimsy; Luddism.

> The page of built in String Methods bears an uncanny resemblance to the
> page on the string module. Is there a historical reason?

Yes:  string methods didn't exist before Python 1.6.  The string module has
always been there.

> Are the built in type methods quite recent?

Python 1.6 was released in 2000.  Whether that's quite recent depends on
whether you reckon in, say, geological time or computer time <wink>.

If you like investigating this kind of thing, see Misc/HISTORY and Misc/NEWS
in your Python distribution (the latter gets prepended to the former as the
centuries fly by).

More information about the Python-list mailing list