List index method for complex list item types?

Steven D'Aprano steve at REMOVETHIScyber.com.au
Fri Dec 30 22:43:18 EST 2005


On Fri, 30 Dec 2005 18:56:47 -0800, techiepundit wrote:

> Mike,
> 
> I'm trying to figure out dictionaries using the documentation. Clicking
> on "dictionary type" takes me to "2.3.8 Mapping Types -- classdict". Is
> that the documentation for the dictionary type? If so, I do not see an
> "append" or "add" or "insert" method defined in the list of methods on
> that page.

No you don't. Why do you think dicts need one?

> Here's what they list:
> 
> Operation Result Notes
> len(a) the number of items in a
> a[k] the item of a with key k (1)
> a[k] = v set a[k] to v

x = a[k] # get the value in dict a with key k
a[k] = x # set the value in dict a with key k

What more do you need? 



-- 
Steven.




More information about the Python-list mailing list