i'm looking @ code loads data in following way:
idtofoo, idtobar, idtobaz = loadflibbets()
each of these dict between id , corresponding data value.
this used in way similar to:
for id in idtofoo: foo = idtofoo[id] bar = idtobar[id] baz = idtobaz[id] # process flibbet
my oo pattern of thinking tells me code easier understand if define class held foo
, bar
, baz
properties fields, , changed resembling:
flibbets = loadflibbets() flibbet in flibbets: # process flibbet using flibbet.foo, flibbet.bar , flibbet.baz
which more pythonic approach? i'm relatively new python , i've inherited code find quite hard reason about, may need think differently. more python experience comment?
Comments
Post a Comment