anotherCoder
anotherCoder

Reputation: 732

save all config VS access configObj for each field

I have a config file abc.ini with trivial fields

[SET_1]
a=1
b=2
c=3

[SET_2]
d=4
e=5

Now, in the script(python) I can do 2 things:

  1. Access the file abc.ini once and save all config in a data structure
  2. Access the each field where I need them as configObj[SET_1][a] etc

Which of these is more efficient and why.

Upvotes: 0

Views: 35

Answers (1)

TomK
TomK

Reputation: 364

A ConfigObj section actually inherits from a Python dict, so both approaches will actually use the same underlying data structure. There will be no difference in performance.

Upvotes: 1

Related Questions