[: [ 'spamcopy input list so we don' impact caller changes our list copy only both of these copying schemes don' stop the function from changing the object--they just prevent those changes from impacting the caller to really prevent changeswe can always convert to immutable objects to force the issue tuplesfor exampleraise an exception when changes are attemptedl [ changer(xtuple( )pass tupleso changes are errors this scheme uses the built-in tuple functionwhich builds new tuple out of all the items in sequence (reallyany iterableit' also something of an extreme--because it forces the function to be written to never change passed-in argumentsthis solution might impose more limitations on the function than it shouldand so should generally be avoided (you never know when changing arguments might come in handy for other calls in the futureusing this technique will also make the function lose the ability to call any list-specific methods on the argumentincluding methods that do not change the object in place the main point to remember here is that functions might update mutable objects like lists and dictionaries passed into them this isn' necessarily problem if it' expectedand often serves useful purposes moreoverfunctions that change passed-in mutable objects in place are probably designed and intended to do so--the change is likely part of well-defined api that you shouldn' violate by making copies howeveryou do have to be aware of this property--if objects change out from under you unexpectedlycheck whether called function might be responsibleand make copies when objects are passed if needed simulating output parameters and multiple results we've already discussed the return statement and used it in few examples here' another way to use this statementbecause return can send back any sort of objectit can return multiple values by packaging them in tuple or other collection type in factalthough python doesn' support what some languages label "call by referenceargument passingwe can usually simulate it by returning tuples and assigning the results back to the original argument names in the callerdef multiple(xy) [ return xy [ xl multiple(xlchanges local names only return multiple new values in tuple assign results to caller' names argument-passing basics