How to rewrite this as list comprehension?
Serge Beaumont
serge at sergebeaumont.com
Tue Dec 19 07:07:49 EST 2000
Hello,
I'm trying to get my head around comprehensions. How would I rewrite this
method?
def deadThings(self, type = None):
deadThings = self.destroyed[:]
for thing in self.things:
if thing.destroyed:
if type:
if isinstance(thing, type):
deadThings.append(thing)
else:
deadThings.append(thing)
return deadThings
--
Serge Beaumont
Architect
IQUIP Informatica BV
serge.beaumont at iquip.nl
=====================
www.iquip.nl
www.sergebeaumont.com
=====================
More information about the Python-list
mailing list