This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tweiler
Recipients tweiler
Date 2009-03-27.14:54:16
SpamBayes Score 9.738192e-07
Marked as misclassified No
Message-id <1238165659.22.0.188261777341.issue5579@psf.upfronthosting.co.za>
In-reply-to
Content
Now that python has an ordered dictionary it would be great to have a
display sytax for creating them.

To create a dict I just use the dict display syntax:
newdict = {'fred':'flintstone', 'barney':'rubble', 'dino':'thedinosaur'}

I'd like to be able to create an OrderedDict in the same way - I realize
that a list of tuples would do the trick, but I find the dict display
more convenient and readable.  Back in the archives there is probably a
whole discussion of why dict displays are useful.  My reason for liking
displays is that I like to put dictionaries inside dictionaries - the
display format spread out over several lines makes this easy to read.

Possible solutions:

1. maybe use ^{ for OrderedDicts
newdict = ^{'fred':'flintstone', 'barney':'rubble', 'dino':'thedinosaur'}

2. have OrdredDict accept a dictionary display string
newodict = OrderedDict("{'fred':'flintstone', 'barney':'rubble',
'dino':'thedinosaur'}"}
History
Date User Action Args
2009-03-27 14:54:19tweilersetrecipients: + tweiler
2009-03-27 14:54:19tweilersetmessageid: <1238165659.22.0.188261777341.issue5579@psf.upfronthosting.co.za>
2009-03-27 14:54:18tweilerlinkissue5579 messages
2009-03-27 14:54:16tweilercreate