----- Original Message -----
On Fri, Jul 13, 2012 at 10:38:26AM +0200, Vratislav Podzimek wrote:
On Thu, 2012-07-12 at 10:11 -0400, Martin Gracik wrote:
new.unknownFSlines = copy.copy(self.unknownFSlines)Aren't the members of self.unknownFSlines list just strings? Is the copy.copy necessary? Wouldn't plain self.unknownFSlines[:] be enough?
copy.copy() seemed better readable to me. In the discussion on IRC Martin suggested the one more way to do the copy:
new.unknownFSlines = list(self.unknownFSlines)
that would work also for tuples and generators. Any preferences? I will change this to one of the methods not needing the import before pushing. Does this patch otherwise look good?
Why do we need to handle tuples and generators? I prefer [:] unless there is a compelling reason to use something else.
We don't. But the list() method is supposed to be "a better way to copy list" instead of [:], which is a bit cryptic. But I agree that [:] is a commonly used idiom for making a copy of a list, I use it all the time.
http://henry.precheur.org/python/copy_list
The rest of it looks good to me. I just think copy.copy is overkill for a list of strings.
-- Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
anaconda-patches mailing list anaconda-patches@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/anaconda-patches