I am running Python 3.3 on MS Windows. Any idea why is this?
Hi guys,Prior to Python 3.6 (de facto) and Python 3.7 (officially), there was no guarantee at all about the order of keys in a dict. If you need the keys
I have a strange problem that I do not understand. I am testing function which returns a dictionary. The code should ensure that the keys of the dictionary are generated in a given order.
I am testing the function with the standard unittest module and use the assertListEqual statement to verify the sequence. Sometimes this test
fails, sometimes passes without any change neither in the code, nor in the testcase. I am using "list(myDict.keys())" to create the list of the keys
of the dictionary.
I am running Python 3.3 on MS Windows. Any idea why is this?
Hi guys,
I have a strange problem that I do not understand. I am testing function which returns a dictionary. The code should ensure that the keys of the dictionary are generated in a given order.
I am testing the function with the standard unittest module and use the assertListEqual statement to verify the sequence. Sometimes this test
fails, sometimes passes without any change neither in the code, nor in the testcase. I am using "list(myDict.keys())" to create the list of the keys
of the dictionary.
I am running Python 3.3 on MS Windows. Any idea why is this?
On 3/4/2023 11:38 AM, Gabor Urban wrote:How would that enable you to check that the keys in the dict are in a
Hi guys,
I have a strange problem that I do not understand. I am testing function which returns a dictionary. The code should ensure that the keys of the dictionary are generated in a given order.
I am testing the function with the standard unittest module and use the assertListEqual statement to verify the sequence. Sometimes this test fails, sometimes passes without any change neither in the code, nor in the testcase. I am using "list(myDict.keys())" to create the list of the keys of the dictionary.
I am running Python 3.3 on MS Windows. Any idea why is this?
List order would not be guaranteed. Sort the list first. Then your
problem should clear up.
Thomas Passin schreef op 4/03/2023 om 18:49:
On 3/4/2023 11:38 AM, Gabor Urban wrote:How would that enable you to check that the keys in the dict are in a specific order?
Hi guys,function
I have a strange problem that I do not understand. I am testing
which returns a dictionary. The code should ensure that the keys of theuse the
dictionary are generated in a given order.
I am testing the function with the standard unittest module and
assertListEqual statement to verify the sequence. Sometimes this testin the
fails, sometimes passes without any change neither in the code, nor
testcase. I am using "list(myDict.keys())" to create the list of thekeys
of the dictionary.
I am running Python 3.3 on MS Windows. Any idea why is this?
List order would not be guaranteed. Sort the list first. Then your
problem should clear up.
Thomas Passin schreef op 4/03/2023 om 18:49:
On 3/4/2023 11:38 AM, Gabor Urban wrote:
Hi guys,
I have a strange problem that I do not understand. I am testing function which returns a dictionary. The code should ensure that the keys of the dictionary are generated in a given order.
I am testing the function with the standard unittest module and use the assertListEqual statement to verify the sequence. Sometimes this test fails, sometimes passes without any change neither in the code, nor in the
testcase. I am using "list(myDict.keys())" to create the list of the keys of the dictionary.
I am running Python 3.3 on MS Windows. Any idea why is this?
List order would not be guaranteed. Sort the list first. Then your problem should clear up.How would that enable you to check that the keys in the dict are in a specific order?
| Sysop: | Keyop |
|---|---|
| Location: | Huddersfield, West Yorkshire, UK |
| Users: | 715 |
| Nodes: | 16 (2 / 14) |
| Uptime: | 149:29:30 |
| Calls: | 12,091 |
| Calls today: | 4 |
| Files: | 15,000 |
| Messages: | 6,517,580 |