Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1048665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:29:37+00:00 2026-05-16T16:29:37+00:00

Does native built-in python dict guarantee that the keys() and values() lists are ordered

  • 0

Does native built-in python dict guarantee that the keys() and values() lists are ordered in the same way?

d = {'A':1, 'B':2, 'C':3, 'D':4 } # or any other content
otherd = dict(zip(d.keys(), d.values()))

Do I always have d == otherd ?

Either it’s true or false, I’m interested in any reference pointer on the subject.

PS: I understand the above property will not be true for every objects that behave like a dictionary, I just wonder for the built-in dict. When I test it looks as if it’s true, and it’s no surprise because having the same order for keys() and values() is probably the simplest implementation anyway. But I wonder if this behavior was explicitly defined or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:29:38+00:00Added an answer on May 16, 2026 at 4:29 pm

    Keys and values are listed in an arbitrary order which is non-random, varies across Python implementations, and depends on the dictionary’s history of insertions and deletions. If items(), keys(), values(), iteritems(), iterkeys(), and itervalues() are called with no intervening modifications to the dictionary, the lists will directly correspond.

    From the documentation for dict.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any (hopefully free/open source) code available that does native TLS/SSL communication? I
Does the native Blackberry API allow for the modification of any messaging interface? For
I have a native release dll that is built with symbols. There is a
Does anyone know any good tutorial about using NAnt for native code build process
If I write an application in java, does it use native widgets if run
Native Array in Emberjs does not support deep copy? I saw it just returning
When I sort an Array using the native sort method, which algorithm does Ruby
In this display.newText parameter, what does 16*2 mean? Thanks. local display_txt=display.newText(Wait,0,0,native.SystemFont,16*2)
Considering libevent vs. libev . Does the libev library have native support of IOCP
Does anyone know if there is a way to generate different code in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.