On 24/04/13 16:52, Dave Angel wrote:
Does it mean? ; totalViruses[i] = totalViruses[i]/float(numTrials)
As the others have said, that's exactly right, at least if
totalViruses[i] is immutable, like an int or a float.
What difference does immutability make here?
Even if totalViruses[i] is mutable (an object
or another mutable type) it would still work
provided it supported the division operator
for floats. Or am I missing something?
It's a subtle distinction, but for now, just remember that it's true for
"numbers", but that somebody might redefine one of these operators for
other object types. They could not do that for numbers, however.
Surely you could redefine it for a subclass of numbers too?
Or, again, am I missing something?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor