[issue19026] OrderedDict should not accept dict as parameter

2013-09-17 Thread Georg Brandl
Georg Brandl added the comment: > Right. That's why it should not accept input that can only be > unordered (including dict and **kwargs) - this is what I mean by > strict mode. That's not even true: the empty and the one-element dict are always ordered. -- nosy: +georg.brandl

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread anatoly techtonik
anatoly techtonik added the comment: On Sun, Sep 15, 2013 at 9:25 PM, Raymond Hettinger wrote: > > In general, it is not possible for a hypothetical StrictOrderedDict to know > whether its input was ordered or not. Right. That's why it should not accept input that can only be unordered (includ

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: In general, it is not possible for a hypothetical StrictOrderedDict to know whether its input was ordered or not. For the specific case of dict, it is possible, but the general case is of course completely general (i.e. if the input has a keys() method, th

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- status: pending -> closed ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: http

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread anatoly techtonik
anatoly techtonik added the comment: Is it possible to make strict OrderedDict an optional feature? Like `from features import strict_ordered_dict'? -- status: closed -> pending ___ Python tracker

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread anatoly techtonik
anatoly techtonik added the comment: I don't know if it is bug or feature. There are probably cases when order is not important and OrderedDict is used, but I don't remember any. Too bad Python doesn't have first class ordered mapping type, so that it could report error if unordered arguments

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread Raymond Hettinger
Raymond Hettinger added the comment: An OrderedDict is a dict subclass and needs to accept the same inputs as dict methods. This is a guaranteed API and not a bug. It is not the OrderedDict's fault if you supply an unordered input. It can't add order after the fact. -- assignee: ->

[issue19026] OrderedDict should not accept dict as parameter

2013-09-15 Thread anatoly techtonik
New submission from anatoly techtonik: http://stackoverflow.com/questions/15733558/python-ordereddict-not-keeping-element-order I wonder why OrderedDict accepts dict as parameter in a first place? OD is used when order is important and if plain dict is supplied, the order is lost. >>> d =