Change "in list(mydict.keys())" to "in mydict" when possible
If the keys of the dictionary are not changing (no insertions or deletions) it is possible to iterate on the keys instead of creating a list and iterating on it. This is more efficient. The logic is the same.
The list creation is necessary if the keys of the dictionary may change.
The construct results form the automatic conversion that uses it all the times to avoid problems when it is needed
#2 Updated by Marco Mambelli about 1 month ago
Changes in v39/24960
Using "grep -R list * | grep -v ^doc | grep -v ^Binary | grep keys" to find possible occurences.
Started replacing them from the top, first commit:
creation/lib/cWDictFile.py creation/lib/cWParams.py creation/lib/cgWDictFile.py creation/lib/cgWParamDict.py creation/lib/cgWParams.py creation/lib/cvWParamDict.py creation/lib/cvWParams.py creation/lib/xmlConfig.py factory/glideFactoryMonitoring.py
Many more to do in the remaining files (factory, frontend, install/services, lib, tools, unittests).