WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[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