Use of dictionary in RE framework


Please tell me the why there is need of dictionary in RE framework ? How the use of dictionary improving the performance ? How is it different from list ?



That’s a good question
Usually dictionary is like key and value pair way of accessing the input
That is if we know the key name then we get the value of that key and use it any where we want

Usually in REFramework we will be using dictionary to access the config file
Config file will be having so many inputs to the process with name and it’s values
So if we have them as dictionary inside the reading and storing the value in a variable it Would be easy to access

When we are using dictionary, number of variable creation gets reduced this memory usage gets reduced that is when dictionary is used along the process being a collections it can store any number of key and its value in it
So we don’t need to create separate variable to store all those values thus the memory reduces and performances increases

List is completely different from dictionary
Though both of them are collections list won’t have any key with it and we need to mention the index to gets it value at a respective index position where as in dictionary we can get the value with its key

Hope this would help you
Cheers @Shirish


List you can store duplicate values. It can be single dimensional. list
Where as in dictionary you can’t. And dictionary is 2-dimensional. dict<key,Value>
And dictionary represents key/value pairs. where key should be unique and you can retrieve/update the value based on key.

Karthik Byggari


True, but another great thing about dictionairies is, that you can store several values for one key, if you want to. As value you just put another Tuple:


Can come in handy sometimes :slight_smile:
Cheers, Lukas


But tuple means not many if I want many values then ?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.