str vs dict API size (was 'Re: left padding zeroes on a string...')

Ron_Adam radam2 at tampabay.rr.com
Fri Mar 25 23:10:21 EST 2005


On Fri, 25 Mar 2005 18:06:11 -0500, "George Sakkis"
<gsakkis at rutgers.edu> wrote:

>
>I'm getting off-topic here, but it strikes me that strings have so many methods (some of which are
>of arguable utility, e.g. swapcase), while proposing two useful methods (http://tinyurl.com/5nv66)
>for dicts -- a builtin with a considerably smaller API than str -- meets so much resistance. Any
>insight ?
>
>George
>

I did a quick check.

>>> len(dir(str))
63
>>> len(dir(int))
53
>>> len(dir(float))
45
>>> len(dir(dict))
40
>>> len(dir(list))
42
>>> len(dir(tuple))
27

We need more tuple methods!  jk  ;)

Looks like the data types, strings, int an float; have more methods
than dict, list, and tuple. I would expect that because there is more
ways to manipulate data than is needed to manage containers.

Ron





More information about the Python-list mailing list