On Mon, Dec 6, 2010 at 11:09 AM, Joel Schwartz <j...@joelschwartz.com>wrote:
> Chris, > > Can you say more about number (7) in your list? What does "pass by value" > mean and what are the alternatives? > Pass by value is exactly what it sounds like - you pass the value (a copy of everything in the memory). This is bad when you're passing a 10,000 item list to a function - because you now have *two* 10,000 item lists. It's even worse when you have many times that amount of data. Python, OTOH passes by reference - instead of copying the list, a pointer to the list is passed, so when you see something like this: def do_something(a_list): a_list[2] = 4 mylist = [1,2,3,4] do_something(mylist) now mylist is: [1,2,4,4]. This is much more efficient (although it tends to bite novice programmers!). HTH, Wayne
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor