« first day (2071 days earlier)      last day (1151 days later) » 

12:09 AM
^^^^^^ (I mean a toy programming language -- which makes the analogy closer :-D )
@Dev-iL I tried that yesterday, but it leaves a vertical line on the right
 
 
12 hours later…
12:35 PM
posted on March 02, 2021 by Cleve Moler

I published Round, With Ties to Even a couple of days ago. Steve Eddins and Daniel Dolan immediately had substantive comments. Here is my reaction to their comments.... read more >>

 
12:48 PM
@ballBreaker nice! :D congrats
 
 
6 hours later…
6:34 PM
thanks everyone :)
 
 
3 hours later…
10:00 PM
D: is @Adriaan not pingable anymore @PinkElephant ???
 
10:14 PM
@AndrasDeak What do you think is the use or the rationale for Python's "pass by name" behaviour? I mean, with A = [10,20,30]; B = A you have to remember that A and B point to the same object, which can be confusing. The justification may be to avoid unnecessary copies? So the programmer can do something like B = A.copy if they want an (independent) copy of the original list, and B = A if a copy is not needed, to save memory
I think the analogous thing in Matlab is the "copy on write" optimization of the interpreter, which avoids a copy of the array if not needed (the contents don't change), and does the copy if needed (an entry of the array is modified). This is automatic and hidden to the programmer, whos is free to think that two copies exist.
In contrast, Python's way seems to me like moving responsibility to the programmer: by default both A and B are the same copy of the array, in order to optimize memory, and if you need a separate copy it's up to you to explicitly do it
Is that the main reason for Python's "pass by name"? Or is there something else?
 
I know you didn't ask me but I hope you don't mind: Isn't this a consequence of python being quite object oriented, and therefore behaving similar like many other object oriented languages?
Also I notice that you seem to talk quite a bit about python recently, have you joined the dark snake side?
 
10:30 PM
@LuisMendo it's just how python is. References underpin the whole language. There's not much to think about it.
the reason is probably "Guido thought it's a good idea when he created the language".
In MATLAB almost everything is an array. Python makes very heavy use of containers. Lists, dicts, sets; these would all have to copy if we made A = B copy.
But I love how powerful it makes the language, at the cost of every newbie having to read nedbatchelder.com/text/names.html exactly once. I think that's a fair price.
 
11:20 PM
@Andras But how does that make the language more powerful than having immediate copies (possibly with a copy-on-write optimization, transparent to the programmer)
Ah, yes I remember that link. It was very useful for me
 
@LuisMendo you can mutate the shit out of mutable containers
you can't, say, take a subarray in MATLAB and have changes on it affect the original array
and the whole garbage collecting business is completely different due to this
It makes third-party trickery like this perfectly reasonable:
In [141]: arr = np.arange(3*3).reshape(3, 3)
     ...: diagonal = arr.diagonal()
     ...: diagonal.flags['WRITEABLE'] = True  # trickery not yet supported in numpy
     ...: diagonal[:] = -1
     ...: arr
Out[141]:
array([[-1,  1,  2],
       [ 3, -1,  5],
       [ 6,  7, -1]])
I'm not saying that this is a direct consequence of name binding rules, but I think it's a cognate, so to speak
In any case my bottom line will always be "this is just how python works and you better embrace it if you want to use it"
 
11:43 PM
I see. So, while I find a better reason, I can think that this "copies are not made by default, do a copy explicitly if you want to" is a way to delegate copy-on-write-like optimizations to the programmer
Delegating things to the programmer is very much free-open-source-languages-like :-D
Jan 25 '16 at 0:34, by Andras Deak
BWAHAHAHAHAHA
 
Heh
@LuisMendo I'm not sure it's like "should we always copy or should we do [what python does]?" My impression is that name binding is fundamental and copying semantics is just a consequence.
You could look at the languages Guido watched to see if this was inherited from something like ABC
I don't know any of the languages that inspired python
I'm also not great at software design so I'm not the best person to tell you why these things work the way they do.
 

« first day (2071 days earlier)      last day (1151 days later) »