A simple list question.

KraftDiner bobrien18 at yahoo.com
Thu Dec 22 13:14:10 EST 2005


Is there a cleaner way to implement this code?

			if len(self.listOfObjects) == 0:
				self.listOfObjects.append(self.currentObject)
			elif:
				self.listOfObjects[self.currentSlice] = self.currentObject

listOfObjects is a list of lists....
If the listOfObjects is [] then I have to use append to add the first
list
otherwise I can access each list using the index into the list.




More information about the Python-list mailing list