On Wed, Oct 15, 2008 at 12:22 AM, wesley chun <[EMAIL PROTECTED]> wrote:
> >> so if you turn your list into a tuple (I can never remember, is that a > >> cast or a coercion?) > > > >> lX = tuple(lX) > > > > To answer my own question: neither, but it's closer (in spirit) to a > cast. > > you're keeping everyone is suspense! :-) you are creating a brand new > tuple by copying out the references to the objects in the list. then > you assign that tuple to the variable that previously referenced your > original list. > > NOTE: the original object remained as a list with no modifications, > but was probably marked for deallocation when you dropped your > references to it unless there were other references to it. > Yes - if I had stopped and thought for just a few more seconds, I would never have said that in the first place. tuple() is a function like any other; assigning its return value to an object of the same name as its input obviously has nothing to do with either casting or coercion and it was a dumb thing to say. Which was why I retracted it almost immediately. However, what I meant by "closer in spirit" - and it was still a dumb thing to say - was that, if the whole thing happened in a black box and you had no idea of the mechanics, it would have the "flavor" of a cast, as opposed to the "flavor" of coercion. Sorta. Not really. Unfortunately, thanks to the magic of the Internet, I can't just ask everybody to forget I mentioned it... can I? Please? -- www.fsrtechnologies.com
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
