01 June 2009

note to self

When you start writing hacks like this:

for attr in ['Something1','someThing2'...'SomeThing215']:
... it's probably time for a subclass.


Giulio Piancastelli said...

...and it's probably time to repent as well. How did you get trapped into that mess in the first place? :-D

GiacomoL said...

When you have to manage 20+ textual fields in one screen, you take all the shortcuts you can find :)

Note that I only reduced the hackery, but it's still there and I honestly can't find a better way; it's now something like this:
for item in mysequence: self.__dict__[item+'Entry'] = NewClass(item)