Alex Martelli wrote: > Frank Millman <[EMAIL PROTECTED]> wrote: > ... > > If they are all equivalent from a functional point of view, I lean > > towards the second version. I agree with Rune that the third one is > > nicer to read, but somehow the [:] syntax makes it a bit more obvious > > what is going on. > > I vastly prefer to call list(xxx) in order to obtain a new list with the > same items as xxx -- couldn't be more obvious than that. > > You can't claim it's obvious that xxx[:] *copies* data -- because in > Numeric, for example, it doesn't, it returns an array that *shares* data > with xxx. So, the [:] notation sometimes copies and sometimes does not, > list list(...) always copies -- if I want to ensure that a copy does > happen, then list(...) is the more obvious and readable choice. > > > Alex
Thanks very much for the detailed explanation. Frank -- http://mail.python.org/mailman/listinfo/python-list