Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

OrderedDict dict/list representation #101446

Closed
Labels
type-featureA feature request or enhancement
@SimpleArt

Description

@SimpleArt

I know that for historical purposes,OrderedDict.__repr__ displays key-value pairs in the format of[(key, value), ...], since the{key: value, ...} representation did not respect the ordering thatOrderedDict needs. However, this was only in the past and it has become a while since dictionaries have become ordered, so I was wondering if changing theOrderedDict.__repr__ to displayOrderedDict({key: value, ...}) instead would be fine. The main rationale is that this is syntactically cleaner to read, often I have found the other representation to be a lot more clunky. Other than potentially breaking things like doc-tests, I don't see much issue with this. The only potential ambiguity that I see is the fact that one might not be immediately sure that the dictionary is ordered, but the fact that it is wrapped byOrderedDict(...) would probably dispel any doubts.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-featureA feature request or enhancement

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp