greg [EMAIL PROTECTED] writes:
Steven D'Aprano wrote:
At least some sections of the Java community seem to prefer a
misleading and confusing use of the word value over clarity and
simplicity, but I for one do not agree with them.
I don't see anything inherently confusing or misleading
On Nov 19, 2008, at 11:05 AM, Douglas Alan wrote:
Personally, I find this whole debate kind of silly, as it is based on
a completely fallacious either/or dichotomy.
(1) It is unarguably true that Python and Java use a type of
call-by-value. This follows from the standard definition of
I've just come to the conclusion it's not possible to call functions
in python, to do so is undefined and indeterminate, like dividing by
zero. Henceforth no calling functions for me as clearly it's the
devil's playground.
--
http://mail.python.org/mailman/listinfo/python-list
On Nov 19, 12:28 pm, Joe Strout [EMAIL PROTECTED] wrote:
On Nov 19, 2008, at 11:05 AM, Douglas Alan wrote:
(2) It is also unarguably true that saying that Python or Java use
call-by-value, and saying nothing more is going to be profoundly
confusing to anyone who is learning these
Joe Strout [EMAIL PROTECTED] writes:
Q. What type of calling semantics do Python and Java use?
A. Call-by-sharing.
Fair enough, but if the questioner then says WTF is call-by-sharing,
we should answer call-by-sharing is the term we prefer for call-by-
value in the case where the value
arguably even older than that to Lisp.
Firstly, thanks to those that have responded to my part in this
debate, I have found it very informative and interesting as I have the
entire thread. However, with regard to comments that I led myself
astray, I want to reiterate the one thing I find
greg wrote:
Arnaud Delobelle wrote:
But in the course of conversation I might refer to
Napoleon, meaning Napoleon Bonaparte (1769 - 1821) or Napoleon III (1808
- 1873).
That's more like referring to the name 'Napoleon' in
two different namespaces. The original binding still
exists, you're
Steven D'Aprano wrote:
If you equate arguments within the called procedure to the *name* of
the arguments, then changing the arguments would mean changing the NAME
If changing the name means rebinding the name,
then I agree -- that's exactly the point I was trying to
make.
If you equate
greg wrote:
Arnaud Delobelle wrote:
(CBV) An evaluation strategy where arguments are evaluated before
the function or procedure is entered. Only the values of the
arguments are passed and changes to the arguments within the called
procedure have no effect on the actual
Terry Reedy wrote:
In other words, as I acknowledged in my other post, one can say that all
calling is calling by value.
No, those are not other words for what I'm saying.
Call by reference is very demonstrably different
from call by value, as has been pointed out a large
number of times
On Nov 10, 2008, at 8:30 AM, Terry Reedy wrote:
That hinges on what exactly is meant by changes to
the arguments.
Mutating them, like Python does, which is why calling Python CBV
leads people to write buggy code.
In Python it can only mean assigning
directly to the bare name -- anything
Arnaud Delobelle wrote:
// What is passed to foo below is obviously not a 'variable
// reference' as the argument is not a variable.
foo(a[3]); // Now a[3] == 7
foo(b.i); // Now b.i == 7
Yes, it is. By variable I mean what C calls an lvalue,
i.e. something you can assign to.
Joe Strout wrote:
On Nov 10, 2008, at 8:30 AM, Terry Reedy wrote:
That hinges on what exactly is meant by changes to
the arguments.
Mutating them, like Python does, which is why calling Python CBV leads
people to write buggy code.
In Python it can only mean assigning
directly to the bare
Joe Strout wrote:
On Nov 10, 2008, at 8:30 AM, Terry Reedy wrote:
That hinges on what exactly is meant by changes to
the arguments.
Mutating them, like Python does, which is why calling Python CBV leads
people to write buggy code.
In Python it can only mean assigning
directly to the bare
On Nov 7, 3:03 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
1. Is Napoleon a copy of Dobby or are they the same cat?
2. Is Polion a copy of Napoleon or are they the same cat?
3. When we got rid of Napoleon's fleas, was Nelson deflea-ed as well?
4. When Napoleon died, did Nelson die as
Aaron Brady [EMAIL PROTECTED] writes:
Do you ever say to someone, 'Napoleon' will no longer refer to
Nelson. It is this lobster now instead, while you are holding a
lobster?
Not explicitly. But in the course of conversation I might refer to
Napoleon, meaning Napoleon Bonaparte (1769 - 1821)
On Nov 10, 2:45 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
Aaron Brady [EMAIL PROTECTED] writes:
Do you ever say to someone, 'Napoleon' will no longer refer to
Nelson. It is this lobster now instead, while you are holding a
lobster?
Not explicitly. But in the course of conversation I
On Nov 10, 2008, at 2:30 PM, Aaron Brady wrote:
I agree with Terry that all calling is call-by-value, and Steven that
all calling is call-by-bit-flipping. I agree with Joe that call-by-
object is a special case of call-by-value.
Woo! Almost sounds like approaching consensus. :)
However,
On Mon, 10 Nov 2008 08:39:58 -0700, Joe Strout wrote:
By that definition, Java, REALbasic, C++, and VB.NET are all call-by-
reference too (even when explicitly using the ByVal keyword in RB/
VB.NET).
No, they are not call-by-reference either. They are call-by-sharing, just
like Python and
On Mon, 10 Nov 2008 23:16:13 +1300, greg wrote:
(CBV) An evaluation strategy where arguments are evaluated before
the function or procedure is entered. Only the values of the
arguments are passed and changes to the arguments within the called
procedure have no effect on the
Arnaud Delobelle wrote:
But in the course of conversation I might refer to
Napoleon, meaning Napoleon Bonaparte (1769 - 1821) or Napoleon III (1808
- 1873).
That's more like referring to the name 'Napoleon' in
two different namespaces. The original binding still
exists, you're just switching
Aaron Brady wrote:
I thought of another way Python's passing method could be
implemented. Parameters are passed as namespace-name pairs, and every
time a variable occurs, it's looked up in the namespace it's in. If
it's changed (concurrently) in the outer scope, a copy is made into
the inner
Steven D'Aprano wrote:
But the name isn't the argument. The argument to a function is an object
The *formal* argument *is* a name, and that's what
the phrase changes to the arguments within the called
procedure is talking about.
Take a function foo that takes one formal parameter x. Pass an
On Tue, 11 Nov 2008 16:54:10 +1300, greg wrote:
Steven D'Aprano wrote:
But the name isn't the argument. The argument to a function is an
object
The *formal* argument *is* a name, and that's what the phrase changes
to the arguments within the called procedure is talking about.
If you
Steven D'Aprano wrote:
Not according to my Comp Sci lecturers back in the day, and not according
to my Pascal books.
Pascal books will tell you what call-by-value means
in Pascal. You can't just blindly take that description
and apply it to other languages, just as you can't
take what your
Dennis Lee Bieber wrote:
You must have missed all the threads about binding then... Wherein
a Python assignment statement binds the LHS name to the RHS object
rather than assigns the RHS object value to the LHS
I know that it is sometimes referred to that way. But
nobody seems to get
greg [EMAIL PROTECTED] writes:
Arnaud Delobelle wrote:
What's a variable reference?
It's a reference to a variable. It's what gets passed behind
the scenes when you use a VAR parameter in Pascal, or a
ByRef parameter in VB.
Do you mean you can't do the following C++ snippet in Pascal or
On Sun, 09 Nov 2008 11:17:28 +, Arnaud Delobelle wrote:
greg [EMAIL PROTECTED] writes:
Arnaud Delobelle wrote:
What's a variable reference?
It's a reference to a variable. It's what gets passed behind the scenes
when you use a VAR parameter in Pascal, or a ByRef parameter in VB.
Arnaud Delobelle wrote:
What's a variable reference?
It's a reference to a variable. It's what gets passed behind
the scenes when you use a VAR parameter in Pascal, or a
ByRef parameter in VB.
What you're saying is that in the code below, when foo(q) is called
then 'p' in foo is another
greg wrote:
No. Passing q by value means that the value of the expression 'q',
whatever that is in the language concerned, gets assigned to the
local variable 'p', whatever *that* means in the language concerned.
In other words, as I acknowledged in my other post, one can say that all
Joe Strout wrote:
On Nov 8, 2008, at 2:38 PM, Terry Reedy wrote:
So if you then insist that Python uses call by object,
you're actually saying it uses call by value!
Both Joe and you seem to be engaging in the following bit of sophistry:
In order for code A to call code B, some information
On Nov 8, 6:21 am, greg [EMAIL PROTECTED] wrote:
Arnaud Delobelle wrote:
'Pass by value' is not relevant to Python as variables do not contain
anything.
Where abouts in the phrase pass by value does the word
contain appear?
You don't quote enough context for it to appear.
You don't need
On Nov 7, 2008, at 6:21 PM, Aaron Brady wrote:
Therefore objects don't need names to exist. Having a name is
sufficient but not necessary to exist. Being in a container is
neither necessary -nor- sufficient.
What do you mean? Being in a container isn't necessary, but it
certainly is
On Nov 8, 8:42 am, Joe Strout [EMAIL PROTECTED] wrote:
On Nov 7, 2008, at 6:21 PM, Aaron Brady wrote:
Therefore objects don't need names to exist. Having a name is
sufficient but not necessary to exist. Being in a container is
neither necessary -nor- sufficient.
What do you mean?
On Nov 8, 1:08 am, Steven D'Aprano [EMAIL PROTECTED]
cybersource.com.au wrote:
On Sat, 08 Nov 2008 18:31:47 +1300, greg wrote:
Quote in favor of Steven snip
Example in favor of Steven snip
There's no obviously about it. To anyone who has learned that call-by-
value means that a copy is made,
greg wrote:
Joe Strout wrote:
Something has just occurred to me. If you take the
view that the value of an expression is an object,
then the terms value and object are synonymous.
Nope. The result of an expression is an object with an id, class, and
'value', where 'value' can include
Steven D'Aprano wrote:
In an attempt to keep this post from hitting the ridiculous length of one
(Aside: I've learned one thing in this discussion. Despite the number of
sources I've read that claim that if you pass an array to a C function
the entire array will be copied, this does not
On Nov 8, 3:38 pm, Terry Reedy [EMAIL PROTECTED] wrote:
In order for code A to call code B, some information must be
communicated from A to B. Something we all know ...
That information is a value of some sort. True...
Therefore all calling is calling by value.
Well, yes, if you insist.
On 2008-11-08, Terry Reedy [EMAIL PROTECTED] wrote:
Steven D'Aprano wrote:
In an attempt to keep this post from hitting the ridiculous length of one
(Aside: I've learned one thing in this discussion. Despite the number of
sources I've read that claim that if you pass an array to a C
On Nov 8, 2008, at 2:38 PM, Terry Reedy wrote:
So if you then insist that Python uses call by object,
you're actually saying it uses call by value!
Both Joe and you seem to be engaging in the following bit of
sophistry:
In order for code A to call code B, some information must be
On Nov 8, 10:59 pm, Joe Strout [EMAIL PROTECTED] wrote:
Of course, I've softened my position somewhat, since being shown that
call by sharing is simply a term for call-by-value in the case where
the values are object references. That clearly does apply to Python
(as well as other OOP
On Fri, 07 Nov 2008 00:44:21 -0500, Steve Holden wrote:
Steven D'Aprano wrote:
On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote:
[...]
And by definition, call by value means that the parameter is a copy.
So if you pass a ten megabyte data structure to a function using
call-by- value
On Nov 6, 2008, at 10:35 PM, Steve Holden wrote:
That's good to hear. Your arguments are sometimes pretty good, and
usually well made, but there's been far too much insistence on all
sides
about being right and not enough on reaching agreement about how
Python's well-defined semantics for
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 00:44:21 -0500, Steve Holden wrote:
Steven D'Aprano wrote:
On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote:
[...]
And by definition, call by value means that the parameter is a copy.
So if you pass a ten megabyte data structure to a function
On Thu, 06 Nov 2008 21:31:16 -0700, Joe Strout wrote:
You're wrong, Python variables don't contain *anything*. Python
variables are names in a namespace.
I think we're saying the same thing. What's a name? It's a string of
characters used to refer to something. That which refers to
On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote:
I am probably egregiously misunderstanding. The practical difficulty
with the moving huge blocks of data approach would appear to emerge
when a function that gets passed an instance of some container then
calls another function that
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote:
I am probably egregiously misunderstanding. The practical difficulty
with the moving huge blocks of data approach would appear to emerge
when a function that gets passed an instance of some container then
calls
On Fri, 07 Nov 2008 08:48:19 -0700, Joe Strout wrote:
I think of it this way: every variable is an object reference; no
special syntax needed for it because that's the only type of variable
there is. (Just as with Java or .NET, when dealing with any class type;
Python is just a little more
On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote:
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote:
I am probably egregiously misunderstanding. The practical difficulty
with the moving huge blocks of data approach would appear to emerge
when a function
On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote:
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote:
I am probably egregiously misunderstanding. The practical difficulty
with the moving huge blocks of data approach would appear to emerge
when a function
On Nov 7, 2008, at 10:29 AM, Steven D'Aprano wrote:
Note: I tried to say name above instead of variable but I
couldn't
bring myself to do it -- name seems to generic to do that job.
Lots
of things have names that are not variables: modules have names,
classes
have names, methods have
Joe Strout wrote:
On Nov 6, 2008, at 10:35 PM, Steve Holden wrote:
Note: I tried to say name above instead of variable but I couldn't
bring myself to do it -- name seems to generic to do that job.
Python has two types of names. Some complex objects -- modules,
classes, and functions, and
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 11:37:28 -0500, Steve Holden wrote:
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 10:50:55 -0500, Steve Holden wrote:
I am probably egregiously misunderstanding. The practical difficulty
with the moving huge blocks of data approach would appear to
Steven D'Aprano wrote:
On Fri, 07 Nov 2008 08:48:19 -0700, Joe Strout wrote:
Unfortunately, the term name is *slightly* ambiguous in Python. There
are names, and then there are objects which have a name attribute, which
holds a string. This attribute is usually called __name__ but sometimes
On Nov 7, 2008, at 12:13 PM, Terry Reedy wrote:
Python has two types of names. Some complex objects -- modules,
classes, and functions, and wrappers and subclasses thereof, have
'definition names' that are used instead of a 'value' to print a
representation. Otherwise, names are
On Nov 7, 2008, at 12:35 PM, Terry Reedy wrote:
http://en.wikipedia.org/wiki/Call_by_something#Call_by_sharing
Call by sharing
Also known as call by object or call by object-sharing is an
evaluation strategy first named by Barbara Liskov et al for the
language CLU in 1974[1]. It is used
Joe Strout [EMAIL PROTECTED] writes:
So. How about this for a summary?
Python uses call-by-sharing. That's a special case of call-by-value
where the variables are references to objects; it is these references
that are copied to the parameters, not the objects themselves. For
users of
Joe Strout wrote:
On Nov 7, 2008, at 12:13 PM, Terry Reedy wrote:
[...]
I wonder if that could be tested systematically. Perhaps we could
round up 20 newbies, divide them into two groups of 10, give each one
a 1-page explanation either based on passing object references
by-value, or passing
On Nov 7, 3:03 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
Joe Strout [EMAIL PROTECTED] writes:
So. How about this for a summary?
Python uses call-by-sharing. That's a special case of call-by-value
where the variables are references to objects; it is these references
that are copied
Aaron Brady [EMAIL PROTECTED] writes:
Furthermore, some class models variables like this:
a.b= 'abc'
a.c= 'def'
a.d= 'ghi'
It also allows index access: a[0], a[1], a[2], respectively. 'abc'
has two names: 'a.b', and 'a[0]'. Correct?
You know very well that a.b and a[0] aren't names,
Joe Strout [EMAIL PROTECTED] writes:
As for where I get my definitions from, I draw from several sources:
1. Dead-tree textbooks
You've been reading the wrong textbooks. Read Liskov -- she's called
CLU (and hence Python's) calling strategy call-by-sharing since the
70s.
2. Wikipedia [2]
Joe Strout [EMAIL PROTECTED] writes:
Yes, OK, that's great. But there are several standard pass-by-
somethings that are defined by the CS community, and which are simple
and clear and apply to a wide variety of languages. Pass by object
isn't one of them.
Call-by-sharing *is* one of them,
On Nov 7, 3:39 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
Aaron Brady [EMAIL PROTECTED] writes:
Furthermore, some class models variables like this:
a.b= 'abc'
a.c= 'def'
a.d= 'ghi'
It also allows index access: a[0], a[1], a[2], respectively. 'abc'
has two names: 'a.b', and
Steven D'Aprano wrote:
Python's behaviour is not the same as what
Pascal, or C, calls call-by-value.
Python's assignment is not the same as what Pascal or C calls
assignment, either. Yet we don't hear anyone claim that the
term assignment shouldn't be used in Python.
The difference between
In an attempt to keep this post from hitting the ridiculous length of one
of my posts last night, I'm going to skip over a lot of things Joe writes
that aren't critical. Just because I've skipped over a comment doesn't
mean I agree with it, merely that I don't think it gains much to argue
the
On Fri, 07 Nov 2008 13:05:16 -0700, Joe Strout wrote:
In Python, AFAICT, there is only one type, the object reference. So,
the type of every variable is 'reference', and each one contains a
reference.
This is wrong. If we take variable to mean name, then Python names do
not have types. But
On Sat, 08 Nov 2008 17:12:00 +1300, greg wrote:
Steven D'Aprano wrote:
Python's behaviour is not the same as what Pascal, or C, calls
call-by-value.
Python's assignment is not the same as what Pascal or C calls
assignment, either. Yet we don't hear anyone claim that the term
assignment
Marc 'BlackJack' Rintsch wrote:
You have said the value that is copied is a pointer to the object.
This assumes that call by value means call by copying
the value.
That assumption is WRONG.
It doesn't mean that. It means call by ASSIGNING the
value.
So, you can think of the value of an
Arnaud Delobelle wrote:
'Pass by value' is not relevant to Python as variables do not contain
anything.
Where abouts in the phrase pass by value does the word
contain appear?
You don't need a notion of containment in order for
pass by value to have meaning. All you need is some
notion of a
Joe Strout wrote:
On Nov 5, 2008, at 2:06 PM, Lie wrote:
Another example: pass-by-object.
Here's where we depart, I guess. I think there's no such thing (see
http://en.wikipedia.org/wiki/Evaluation_strategy for example, and the
dead-tree references I have on hand agree).
Something has
On Sat, 08 Nov 2008 18:31:47 +1300, greg wrote:
Marc 'BlackJack' Rintsch wrote:
You have said the value that is copied is a pointer to the object.
This assumes that call by value means call by copying the value.
That assumption is WRONG.
Not according to my Comp Sci lecturers back in
On Sat, 08 Nov 2008 19:30:17 +1300, greg wrote:
Something has just occurred to me. If you take the view that the value
of an expression is an object, then the terms value and object are
synonymous.
So far so good.
So if you then insist that Python uses call by object, you're actually
On Nov 5, 2008, at 12:29 AM, Dennis Lee Bieber wrote:
C++:
void foo(PersonPtr who) {
who-zipcode = 12345;
}
Please show us the type definition of PersonPtr
Sorry, that'd be obvious to anyone experienced in C++, but I shouldn't
assume. It would be:
typedef Person*
On Nov 4, 2008, at 12:57 PM, Hendrik van Rooyen wrote:
4. You now see how a mutating an object within a function tells you
NOTHING about how the reference to that object was passed.
5. You see that the first three languages above are passing a
reference by value and using that to mutate and
I know this thread has grown quite personal for some of its
participants. I am posting in a spirit of peace and understanding :)
Joe Strout [EMAIL PROTECTED] writes:
[...]
Um, no, I've admitted that it's a reference all along. Indeed, that's
pretty much the whole point: that variables in
On Nov 6, 1:44 pm, Arnaud Delobelle [EMAIL PROTECTED] wrote:
I know this thread has grown quite personal for some of its
participants. I am posting in a spirit of peace and understanding :)
Hear, hear.
You refer to docs about the *implementation* of Python in C. This is
irrelevant.
Also,
On Nov 5, 2008, at 2:06 PM, Lie wrote:
http://www.strout.net/info/coding/valref/
I'm fed up with you.
I'm sorry -- I'm really not trying to be difficult. And it's odd that
you're fed up with me, yet you seem to be agreeing with me on at least
most points.
In Von Neumann Architecture
On Nov 6, 2008, at 12:44 PM, Arnaud Delobelle wrote:
I know this thread has grown quite personal for some of its
participants. I am posting in a spirit of peace and understanding :)
Thanks, I'll do the same.
Um, no, I've admitted that it's a reference all along. Indeed,
that's
pretty
Aaron Brady wrote:
and you can't have languages without implementations.
This is either a claim that languages are their own implementations, or
an admission that human brains are the implementation of all languages
thought of by human brains, coupled with a claim that there cannot be
On Nov 6, 6:00 pm, Terry Reedy [EMAIL PROTECTED] wrote:
Aaron Brady wrote:
and you can't have languages without implementations.
This is either a claim that languages are their own implementations, or
an admission that human brains are the implementation of all languages
thought of by human
On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote:
that's
pretty much the whole point: that variables in Python don't contain
objects, but merely contain references to objects that are actually
stored somewhere else (i.e. on the heap).
You're wrong, Python variables don't contain
First, I want to thank everyone for your patience -- I think we're
making progress towards a consensus.
On Nov 6, 2008, at 8:48 PM, Steven D'Aprano wrote:
that's
pretty much the whole point: that variables in Python don't contain
objects, but merely contain references to objects that are
Joe Strout wrote:
On Nov 6, 2008, at 12:44 PM, Arnaud Delobelle wrote:
I know this thread has grown quite personal for some of its
participants. I am posting in a spirit of peace and understanding :)
Thanks, I'll do the same.
That's good to hear. Your arguments are sometimes pretty
Aaron Brady wrote:
On Nov 6, 6:00 pm, Terry Reedy [EMAIL PROTECTED] wrote:
'Associating' is a primitive operation for Python interpreters.
Interesting. If I may be so bold as to ask, is it for C code, C
compilers, and/or C programs?
Sorry, I should have specified for the abstract
Steven D'Aprano wrote:
On Thu, 06 Nov 2008 09:59:37 -0700, Joe Strout wrote:
[...]
And by definition, call by value means that the parameter is a copy. So
if you pass a ten megabyte data structure to a function using call-by-
value semantics, the entire ten megabyte structure is copied.
Joe Strout wrote:
First, I want to thank everyone for your patience -- I think we're
making progress towards a consensus.
Phew.
But putting that aside, consider the Python
code x = 1. Which statement would you agree with?
(A) The value of x is 1.
Only speaking loosely (which we can
Steve Holden [EMAIL PROTECTED] writes:
One of the reasons for Python's continue march towards world
domination (allow me my fantasies) is its consistent simplicity.
Those last two words would be my candidate for the definition of
Pythonicity.
+1 QOTW
--
\ Eccles: “I'll get [the
Joe Strout [EMAIL PROTECTED] wrote:
4. You now see how a mutating an object within a function tells you
NOTHING about how the reference to that object was passed.
5. You see that the first three languages above are passing a
reference by value and using that to mutate and object, yet for
Dennis Lee Bieber wrote:
I'm sure all the programmers using FORTRAN for the last 50 years
will be very surprised to hear that it uses call-by-value!
That should be 'last 31 years'. Fortran IV *was* call-by-value, as
least for scalars. I remember spending a couple of hours tracking
On Nov 4, 9:33 am, Joe Strout [EMAIL PROTECTED] wrote:
On Nov 3, 2008, at 5:27 PM, Marc 'BlackJack' Rintsch wrote:
Maybe this is a surprise for you, because we haven't discussed this in
much detail in this group lately, but it applies to Python which does
call-by-object or call-by-sharing.
If the assert statement fails (and it does), then no copy was made and
Python is not call-by-value.
So Python is not call-by-value, and it's not call-by-reference, so ...
either Python doesn't exist, or it uses a different calling convention.
coming from C/C++ Python seemed to me call by
Craig Allen wrote:
That is, python lets you change object references pointing to
immutibles, which looks like changing the value referenced, by
rebinding.
So is that objectionable?
OK once in a while, but it wouldn't do for everyday.
Python 2.5.2 (r252:60911, Jul 31 2008, 17:28:52)
[GCC
On Nov 4, 2008, at 7:42 AM, Craig Allen wrote:
coming from C/C++ Python seemed to me call by reference, for the
pragmatic reason you said, modificaitons to function arguments do
affect the variable in the caller. The confusing part of this then
comes when immutable objects are passed in.
Joe Strout a écrit :
On Nov 3, 2008, at 5:27 PM, Marc 'BlackJack' Rintsch wrote:
Maybe this is a surprise for you, because we haven't discussed this in
much detail in this group lately, but it applies to Python which does
call-by-object or call-by-sharing. ;-)
There's no such thing. Those
On Nov 4, 11:06 am, Joe Strout [EMAIL PROTECTED] wrote:
On Nov 4, 2008, at 7:42 AM, Craig Allen wrote:
coming from C/C++ Python seemed to me call by reference, for the
pragmatic reason you said, modificaitons to function arguments do
affect the variable in the caller. The confusing part
On Tue, 04 Nov 2008 09:16:05 -0800, Craig Allen wrote:
I'm open to pass-by-sharing, or pass-by-object, but neither is
perticularly intuitive, not as obvious in meaning as pass-by-val or
pass-by-reference (or call-by-xxx). I suppose I'd like pass-by-name as
more a description, as name to me
Aaron Brady [EMAIL PROTECTED] wrote:
I think we can conclude that Python passes by reference, since a
function can modify objects that were passed in to it.
Sort of - if the modification is by side effect - so you
can append to a list, for instance.
However, if you use the passed param name on
On Mon, 03 Nov 2008 19:33:52 -0700, Joe Strout wrote:
On Nov 3, 2008, at 5:27 PM, Marc 'BlackJack' Rintsch wrote:
Maybe this is a surprise for you, because we haven't discussed this in
much detail in this group lately, but it applies to Python which does
call-by-object or call-by-sharing.
On Tue, 04 Nov 2008 09:06:45 -0700, Joe Strout wrote:
This example is also call-by-value, but the value in this case is a type
that has no analog in Python.
I'm disappointed to see that my prediction that Joe would, yet again,
utterly ignore all the arguments against his pet theory was
On Tue, 04 Nov 2008 09:16:05 -0800, Craig Allen wrote:
When you consider the status of the entity x in x=1 in python, it is
a pointer, and python looks like pass by value.
Nonsense. Python doesn't have pointers. You're letting Joe confuse you.
Python has objects: *everything* in Python is an
1 - 100 of 214 matches
Mail list logo