Problem with a for loop and a list

Bruno Desthuilliers bruno.42.desthuilliers at websiteburo.invalid
Wed Jul 2 11:05:27 CEST 2008

Alexnb a écrit :
> I am not sure what is going on here. Here is the code that is being run:
> def getWords(self):
>         self.n=0
>         for entry in self.listBuffer:
>             self.wordList[self.n] = entry.get()
>         self.n=self.n+1

>         print self.wordList

def get_words(self):
     self.word_list = [e.get() for e in self.list_buffer]

> This is the "listBuffer" that you see:
> self.listBuffer=[self.e1, self.e2, self.e3, self.e4,
>                          self.e5, self.e6, self.e7, self.e8,
>                          self.e9, self.e10, self.e11,
>                          self.e12, self.e13, self.e14]

What a fantastic naming scheme. So easy to read, understand and 
maintain. Congratulation, you just won the right to read "How to write 
unmaintainable code":

More information about the Python-list mailing list