From: Bruce S. <Bru...@nc...> - 2008-12-11 18:51:32
|
After some discussion with David Scherer, we're convinced that scene.objects should indeed remain a tuple in Visual 5.0, not a list. As he says, "Lists are mutable, so the user can try to do things like del scene.objects[2] and won't get any error message or indication that they are not doing the right thing. IMO error checking is MORE important than backward compatibility: hardly anyone will remember Visual 3 in a year, but people will make the same errors forever." But I also have a question about the example code you show. m.pick is the object picked, so you already know the object. What value is there in knowing the sequence position of this object in scene.objects, where the order of the objects is not relevant? Bruce Sherwood Roberto Aguirre Maturana wrote: >> I wasn't aware of a change from list to tuple for scene.objects, but >> clearly it ought to be a tuple, not a list, as this should not be a >> modifiable sequence. In what context did it matter that it was a list >> rather than a tuple? >> > > Like in the following example, when you need to recover the index of a > previously picked object: > > > varCurrentObject = m.pick > > (...) > > #The following line gets an error on Visual 5, yet it works on Visual 3: > varCurrentObjectIndex=scene.objects.index(varCurrentObject) > > |