[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [PATCH,v2]: add libxl python binding



On Sat, 2010-09-11 at 15:48 +0100, Ian Campbell wrote:
> On Fri, 2010-09-10 at 18:03 +0100, Gianni Tedesco wrote:
> > 
> > +    ret = filter(lambda x:True, types) # deep copy 
> 
> I think this is more normally written "ret = list(types)", "ret =
> types[:]", or:
>     from copy import copy
>     ret = copy(types)

I think i prefer types[:] (forgot about that) - copy module is a
nightmare and IMO nastiest part of python language is semantics viz deep
vs shallow copies. Does list() even do deep copy?? (I had no idea)

> Although given that the caller does:
>     types = tree_frob(types)
> why is the deep copy necessary? tree_frob could work in-place.

Well, it's going to end up doing the tree flattening for the keyed union
type that needs to be handled. Just makes it simpler than keeping around
an original list that may or may not contain what you think it does at
that point.



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.