On Tue, Dec 8, 2015 at 8:38 AM, Terry Reedy <tjre...@udel.edu> wrote: >> def list_actors( self ): >> h=[] >> for n in self.actors: >> h.append( n.get_name() ) >> return h > > > return list(self.actors) # or perhaps even faster > return self.actors[:]
Not identical semantics. This is a use-case for a comprehension: return [n.get_name() for n in self.actors] (although I would eschew the getter in favour of just "n.name") ChrisA -- https://mail.python.org/mailman/listinfo/python-list