New submission from Todd Weiler <twei...@raggedcreek.com>:

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'}"}

----------
messages: 84261
nosy: tweiler
severity: normal
status: open
title: Display for OrderedDict
type: feature request
versions: Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue5579>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to