2008-07-15: Selected articles now have experimental "comment" links in the left column and at the bottom. You're welcome to use them for commenting and voting on articles. For a bit more on this, see this page. /F

Dictionary displays

A dictionary display is a possibly empty series of key/datum pairs enclosed in curly braces:

Syntax:

{}

dict_display ::= “{” [[key_datum_list][1]] “}” key_datum_list ::= [ key_datum][2] (“,” [key_datum][2])* [“,”] key_datum ::= [ expression][3] “:” [expression][3]

A dictionary display yields a new dictionary object.

The key/datum pairs are evaluated from left to right to define the entries of the dictionary: each key object is used as a key into the dictionary to store the corresponding datum.

Restrictions on the types of the key values are listed earlier in types. (To summarize, the key type should be hashable, which excludes all mutable objects.) Clashes between duplicate keys are not detected; the last datum (textually rightmost in the display) stored for a given key value prevails.

 

A Django site. this page was rendered by a django application in 0.02s 2008-07-25 10:30:16.117959. hosted by webfaction.