Multi-dimensional list initialization
andrew3 at r3dsolutions.com
Thu Nov 8 01:24:22 CET 2012
On 11/07/2012 01:01 PM, Ian Kelly wrote:
> On Wed, Nov 7, 2012 at 12:51 PM, Andrew Robinson
> <andrew3 at r3dsolutions.com> wrote:
>> Interesting, you avoided the main point "lists are copied with list
> It seems that each post is longer than the last. If we each responded
> to every point made, this thread would fill a book.
It already is :)
> Anyway, your point was to suggest that people would not be confused by
> having list multiplication copy lists but not other objects, because
> passing lists into functions as parameters works in basically the same
Not quite; Although I wasn't clear; The variable passed in is by
*value* in contradistinction to the list which is by reference. Python
does NOT always default copy by reference *when it could*; that's the point.
Hence the programmer has to remember in foo( x,y ), the names x and y
when assigned to -- *DONT* affect the variables from which they came.
But any object internals do affect the objects everywhere.
A single exception exists; My thesis is for a single exception as well
-- I think Python allows that kind of thinking.
> So actually I did address
> this point with the "call-by-object" tangent; I just did not
> explicitly link it back to your thesis.
My apology for not proof reading my statements for clarity. It was
definitely time for a nap back then.
> Potayto, potahto. The distinction that you're describing is between
> "strict" versus "non-strict" evaluation strategies. Hinging the
> distinction on the non-descriptive words "call" and "pass" is lazy
> terminology that should never have been introduced in the first place.
I would do it again. Other's have already begun to discuss terminology
with you -- I won't double team you.
More information about the Python-list