Built-ins vs. modules

Paul Berkowitz berkowit at silcom.com
Mon Apr 14 23:42:30 EDT 2003


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? The page
of built in String Methods bears an uncanny resemblance to the page on the
string module. Is there a historical reason? Are the built in type methods
quite recent?


-- 
Paul Berkowitz







More information about the Python-list mailing list