Re: Reference or Value?

2009-02-22 Thread Steven D'Aprano
On Sun, 22 Feb 2009 13:37:27 -0300, andrew cooke wrote: > as far as i understand things, the best model is: > > 1 - everything is an object > 2 - everything is passed by reference Except that is wrong. If it were true, you could do this: def swap(x, y): y, x = x, y a = 1 b =

Re: Reference or Value?

2009-02-22 Thread Steven D'Aprano
On Sun, 22 Feb 2009 16:13:02 +0100, Torsten Mohr wrote: > Hi, > > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? Never, and never. > Integers are obviously passed by value, lists and dicts by reference.

Re: Reference or Value?

2009-02-22 Thread Andrew Koenig
"andrew cooke" wrote in message news:mailman.464.1235320654.11746.python-l...@python.org... > as far as i understand things, the best model is: > > 1 - everything is an object > 2 - everything is passed by reference > 3 - some objects are immutable > 4 - some (im

Re: Reference or Value?

2009-02-22 Thread andrew cooke
as far as i understand things, the best model is: 1 - everything is an object 2 - everything is passed by reference 3 - some objects are immutable 4 - some (immutable?) objects are cached/reused by the system andrew Torsten Mohr wrote: > Hi, > > how is the rule in Python, if i pass o

Re: Reference or Value?

2009-02-22 Thread MRAB
Torsten Mohr wrote: Hi, how is the rule in Python, if i pass objects to a function, when is this done by reference and when is it by value? def f1(a): a = 7 b = 3 f1(b) print b => 3 Integers are obviously passed by value, lists and dicts by reference. Is there a general rule? S

Re: Reference or Value?

2009-02-22 Thread Duncan Booth
Torsten Mohr wrote: > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? > > def f1(a): > a = 7 > > b = 3 > f1(b) > print b >=> 3 > > Integers are obviously passed by value, lists

Re: Reference or Value?

2009-02-22 Thread Christian Heimes
Torsten Mohr schrieb: > Hi, > > how is the rule in Python, if i pass objects to a function, when is this > done by reference and when is it by value? > > def f1(a): > a = 7 > > b = 3 > f1(b) > print b > => 3 > > Integers are obviously passed by

Reference or Value?

2009-02-22 Thread Torsten Mohr
Hi, how is the rule in Python, if i pass objects to a function, when is this done by reference and when is it by value? def f1(a): a = 7 b = 3 f1(b) print b => 3 Integers are obviously passed by value, lists and dicts by reference. Is there a general rule? Some common formulat

Re: ANN: Python 2.6 Quick Reference available

2009-02-12 Thread Krzysztof Retel
On Feb 12, 12:54 am, pyt...@bdurham.com wrote: > Richard, > > An excellent tool. Great job!!! > > Thank you for sharing this with the Python community. > > Regards, > Malcolm Many thanks Richard and Josh. I've just started my adventure with Python, and this document will help me a lot. Cheers, K

Re: ANN: Python 2.6 Quick Reference available

2009-02-11 Thread python
Richard, An excellent tool. Great job!!! Thank you for sharing this with the Python community. Regards, Malcolm -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Python 2.6 Quick Reference available

2009-02-11 Thread Markus Schreyer
Great stuff! Waiting for the 3.0 version.. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: Python 2.6 Quick Reference available

2009-02-11 Thread Giampaolo Rodola'
On Feb 10, 8:38 pm, Richard Gruet <"rgruet at free dot fr"> wrote: > The Python 2.6 Quick Reference is available in HTML and PDF formats > athttp://rgruet.free.fr/#QuickRef. > > This time I was helped by Josh Stone for the update. > > As usual, your feed

Re: ANN: Python 2.6 Quick Reference available

2009-02-11 Thread Thorsten Kampe
* Richard Gruet (Tue, 10 Feb 2009 20:38:24 +0100) > The Python 2.6 Quick Reference is available in HTML and PDF formats at > http://rgruet.free.fr/#QuickRef. THANK YOU! Thorsten -- http://mail.python.org/mailman/listinfo/python-list

ANN: Python 2.6 Quick Reference available

2009-02-10 Thread Richard Gruet
The Python 2.6 Quick Reference is available in HTML and PDF formats at http://rgruet.free.fr/#QuickRef. This time I was helped by Josh Stone for the update. As usual, your feedback is welcome (pqr at rgruet.net). Cheers, Richard Gruet -- http://mail.python.org/mailman/listinfo/python-list

Re: Using equals operator without changing reference pointer

2009-01-30 Thread mark . seagoe
On Jan 29, 8:03 pm, Terry Reedy wrote: > Erik Max Francis wrote: > > mark.sea...@gmail.com wrote: > > >> Is there a way to lock down myInst so that it still refers to the > >> original object, and is there some special member that will allow me > >> to override the equals operator in this case?  O

Re: Using equals operator without changing reference pointer

2009-01-29 Thread Terry Reedy
Erik Max Francis wrote: mark.sea...@gmail.com wrote: Is there a way to lock down myInst so that it still refers to the original object, and is there some special member that will allow me to override the equals operator in this case? Or is that simply blasphemous against everything Python hold

Re: Using equals operator without changing reference pointer

2009-01-29 Thread Erik Max Francis
mark.sea...@gmail.com wrote: Is there a way to lock down myInst so that it still refers to the original object, and is there some special member that will allow me to override the equals operator in this case? Or is that simply blasphemous against everything Python holds sacred? Certainly ther

Using equals operator without changing reference pointer

2009-01-29 Thread mark . seagoe
instance name returns the int, rather than text about the class name and location in memory. But... it would be wonderful if there was a way to assign a value without using any .member notation... if there were a way for me to specify that the reference would never change. For example: >>&g

Re: Pass by reference

2009-01-02 Thread alex goretoy
You are correct, terminology is a must. In order to stay on the same page. And yes, it;s not technically by ref. but it works for me at the moment. I was doing this in my code: l={"user":"asdf","pass":"goog"} d= { "login_url":"http://example.com/login";, "user":l["user"], "pass":l["pas

Re: Pass by reference

2009-01-02 Thread alex goretoy
You are correct, terminology is a must. In order to stay on the same page. And yes, it;s not technically by ref. but it works for me at the moment. I was doing this in my code: l={"user":"asdf","pass":"goog"} d= { "login_url":"http://example.com/login";, "user":l["user"], "pass":l["pas

Re: Pass by reference

2009-01-01 Thread Terry Reedy
alex goretoy wrote: I recently conquered this pass by ref thing. This is how I did it. What you did was to pass a mutable object and mutate it. Absolutely standard practice in Python. I am glad you learned it, but also learning and using the standard terminology will also help. Hope you e

Re: Pass by reference

2009-01-01 Thread alex goretoy
I recently conquered this pass by ref thing. This is how I did it. Python 2.4.3 (#1, Apr 3 2006, 14:02:53) [GCC 3.4.6] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f1(v): ... v="asdf" ... >>> def f2(v): ... v=["asdf"] ... >>> def f3(v): ...

Re: Pass by reference

2008-12-31 Thread Aaron Brady
On Dec 31, 5:30 am, iu2 wrote: > Hi, > > Is it possible somehow to change a varible by passing it to a > function? > > I tried this: > > def change_var(dict0, varname, val): >   dict0[varname] = val > > def test(): >   a = 100 >   change_var(locals(), 'a', 3) >   print a > > But test() didn't work

Re: Pass by reference

2008-12-31 Thread Chris Rebert
On Wed, Dec 31, 2008 at 5:04 AM, iu2 wrote: > For the 2 targets I have the variables comm1 and comm2. They are of > some class I wrote, representing many properties of the communication, > including the IP address. > There is one function that sends data, and it receives a commX var > (comm1 or c

Re: Pass by reference

2008-12-31 Thread iu2
On Dec 31, 1:48 pm, "Chris Rebert" wrote: ... > > Not really, or at the very least it'll be kludgey. Python uses > call-by-object (http://effbot.org/zone/call-by-object.htm), not > call-by-value or call-by-reference. > > Could you explain why you have to set so m

Re: Pass by reference

2008-12-31 Thread Bruno Desthuilliers
iu2 a écrit : Hi, Is it possible somehow to change a varible by passing it to a function? For which definition of "change a variable" ? I tried this: def change_var(dict0, varname, val): dict0[varname] = val Ok, this is mutating dict0, so it works. def test(): a = 100 change_var(

Re: Pass by reference

2008-12-31 Thread Chris Rebert
then > > var = creaet_obj(var) > > Is there another way? Not really, or at the very least it'll be kludgey. Python uses call-by-object (http://effbot.org/zone/call-by-object.htm), not call-by-value or call-by-reference. Could you explain why you have to set so many variable

Pass by reference

2008-12-31 Thread iu2
Hi, Is it possible somehow to change a varible by passing it to a function? I tried this: def change_var(dict0, varname, val): dict0[varname] = val def test(): a = 100 change_var(locals(), 'a', 3) print a But test() didn't work, the value a remains 100. I have several variables init

Re: Call by reference in SWIG?

2008-12-11 Thread Chris Mellon
On Thu, Dec 11, 2008 at 9:43 AM, Joe Strout wrote: > On Dec 10, 2008, at 10:19 PM, Nok wrote: > >> I can't get call-by-reference functions to work in SWIG... > > Python doesn't have any call-by-reference support at all [1], so I'm not > surprised that a

Re: Call by reference in SWIG?

2008-12-11 Thread Joe Strout
On Dec 10, 2008, at 10:19 PM, Nok wrote: I can't get call-by-reference functions to work in SWIG... Python doesn't have any call-by-reference support at all [1], so I'm not surprised that a straight translation of the call-by-reference C function doesn't work. Unfort

Call by reference in SWIG?

2008-12-10 Thread Nok
I can't get call-by-reference functions to work in SWIG... Even when wrapping a trivial example like this: /* File : trivial.i */ %module trivial %inline %{ class test { public: void foo(int *t) { *t=42; } }; %} I get a TypeError when trying to use it: import tr

Call by reference in SWIG?

2008-12-10 Thread Nok
I can't get call-by-reference functions to work in SWIG... Even when wrapping a trivial example like this: /* File : trivial.i */ %module trivial %inline %{ class test { public: void foo(int *t) { *t=42; } }; %} I get a TypeError when trying to use it: import tr

Re: A question about reference in Python.

2008-12-08 Thread Joe Strout
. But, in Python, how can I do it? Except the sequence, I know not any way. Any variable in Python is a reference Except that they don't behave like references in languages that have explicit reference parameters. I didn't say anything about reference parameters (by which I bel

Re: A question about reference in Python.

2008-12-08 Thread Steven D'Aprano
how >> can I do it? Except the sequence, I know not any way. > > Any variable in Python is a reference Except that they don't behave like references in languages that have explicit reference parameters. Joe, please stop muddying the water. We've been over this to dea

Re: A question about reference in Python.

2008-12-08 Thread Aaron Brady
gt; > Python, how > > can I do it? Except the sequence, I know not any way. > > Any variable in Python is a reference, which is roughly analogous to a   > pointer type in C/C++.  For details and examples, see:   > <http://www.strout.net/info/coding/valref/ You can use any vari

Re: A question about reference in Python.

2008-12-08 Thread Joe Strout
On Dec 7, 2008, at 10:26 PM, Group wrote: Now, I want to write a Red-Black Tree, and a List structure. In C/C+ +, I can use pointers to refer to children notes (or next notes). But, in Python, how can I do it? Except the sequence, I know not any way. Any variable in Python is a reference

Re: A question about reference in Python.

2008-12-08 Thread James Mills
In case the OP is interested here is a more complete implementation (others are welcome to comment): http://codepad.org/drIhqb7Z Enjoy :) cheers James -- -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: A question about reference in Python.

2008-12-07 Thread James Mills
On Mon, Dec 8, 2008 at 4:25 PM, Chris Rebert <[EMAIL PROTECTED]> wrote: > No apology necessary of course, i just didn't want the newbie OP to > pick up any bad Python coding habits. Apologies that I might have > phrased my criticism a bit harshly. No not at all :) I do use class variables in some

Re: A question about reference in Python.

2008-12-07 Thread Chris Rebert
On Sun, Dec 7, 2008 at 10:17 PM, James Mills <[EMAIL PROTECTED]> wrote: > On Mon, Dec 8, 2008 at 4:13 PM, Chris Rebert <[EMAIL PROTECTED]> wrote: >> The following three lines serve no purpose and can only lead to confusion: >>> value = None >>> prev = None >>> next = None > > You are absolute

Re: A question about reference in Python.

2008-12-07 Thread James Mills
On Mon, Dec 8, 2008 at 4:13 PM, Chris Rebert <[EMAIL PROTECTED]> wrote: > The following three lines serve no purpose and can only lead to confusion: >> value = None >> prev = None >> next = None You are absolutely right :) Updated code: #!/home/jmills/bin/python -i class Node(object):

Re: A question about reference in Python.

2008-12-07 Thread Chris Rebert
On Sun, Dec 7, 2008 at 10:09 PM, James Mills <[EMAIL PROTECTED]> wrote: > Hi, > > This is really really really pointless code and a really really pointless > exercise, but nonetheless, here is a very very basic and minimal > implementation of what you're expecting. This should almost > *never* be d

Re: A question about reference in Python.

2008-12-07 Thread James Mills
Hi, This is really really really pointless code and a really really pointless exercise, but nonetheless, here is a very very basic and minimal implementation of what you're expecting. This should almost *never* be done in Python! Python is a superior dynamic programming language, but it's NOT C!

Re: A question about reference in Python.

2008-12-07 Thread Kermit Mei
Chris Rebert wrote: On Sun, Dec 7, 2008 at 9:26 PM, Group <[EMAIL PROTECTED]> wrote: Hello, I'm studying algorithom. For concentrating on the question itself, I intend to use Python to implement the algorithoms. Now, I want to write a Red-Black Tree, and a List structure. In C/C++, I can use

Re: A question about reference in Python.

2008-12-07 Thread Chris Rebert
On Sun, Dec 7, 2008 at 9:26 PM, Group <[EMAIL PROTECTED]> wrote: > Hello, I'm studying algorithom. For concentrating on the question itself, I > intend to use Python to implement the algorithoms. > > Now, I want to write a Red-Black Tree, and a List structure. In C/C++, I can > use pointers to refe

A question about reference in Python.

2008-12-07 Thread Group
Hello, I'm studying algorithom. For concentrating on the question itself, I intend to use Python to implement the algorithoms. Now, I want to write a Red-Black Tree, and a List structure. In C/C++, I can use pointers to refer to children notes (or next notes). But, in Python, how can I do it

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-26 Thread Antoon Pardon
On 2008-11-20, greg <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >> You are changing your argument. In a follow up you >> made the point that call by value should be as it >> was intended by the writers of the algol 60 report. > > No, I was countering the argument that "call by value" > is s

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Steven D'Aprano
On Sun, 23 Nov 2008 09:24:05 -0600, Derek Martin wrote: > On Tue, Nov 18, 2008 at 09:23:30AM +, Steven D'Aprano wrote: >> > How I can answer the question, "are the objects a and b the same or >> > different"? I can look at every aspect of each object, looking for >> > something that is differe

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Steve Holden
Derek Martin wrote: [some stuff, followed by about 32k of unnecessarily quoted crap] It would be helpful if you'd take the time to trim your replies appropriately. regards Steve -- Steve Holden+1 571 484 6266 +1 800 494 3119 Holden Web LLC http://www.holdenweb.com/ -- ht

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Derek Martin
ey don't need an > extra attribute, and in fact the implementation of int objects don't > allow for extra attributes because they have no __dict__ to store them in. > > > > So clearly the 2-ness of int(2) is built into the object and is not > > visible *except

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-23 Thread Arnaud Delobelle
Aaron Brady <[EMAIL PROTECTED]> writes: > Truth and clarity are not tired of this thread. This is such a marvellously economic way of putting it, it's poetic! -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-22 Thread Aaron Brady
e specific case of call-by- > value where the values passed are object references." Better: Objects are passed to functions without copying, and assignment assigns a new identity to the variable, without changing the old object. Round peg, round hole. The only purpose it serves to keep br

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-22 Thread Joe Strout
On Nov 22, 2008, at 4:08 AM, Aaron Brady wrote: Furthermore, to apply c-b-v to Python, you have to introduce the concept of pointers, which is ostensibly non-native for human programmers. Not necessarily "pointers" per se -- any type of object references will do, and yes, Python has those in

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-22 Thread Aaron Brady
On Nov 21, 8:53 pm, greg <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > Call-by-value has other characteristics that Python does not > > meet. > > The designers of most other dynamic languages don't > seem to share that opinion, since they use the term > call-by-value just as though it *does*

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Aaron Brady wrote: Call-by-value has other characteristics that Python does not meet. The designers of most other dynamic languages don't seem to share that opinion, since they use the term call-by-value just as though it *does* mean call- by-assignment and nothing more. -- Greg -- http://mai

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread Aaron Brady
On Nov 21, 7:06 pm, greg <[EMAIL PROTECTED]> wrote: > Aaron Brady wrote: > > Tell me, what happens during a call to the following C++ function? > > > void f( std::vector< int > x ); > > The same thing as would happen if you wrote > >    std::vector x = actual_parameter_expression; > > > what happen

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Steven D'Aprano wrote: You've just *assumed* that assignment in Algol 60 doesn't involving copying. I've done no such thing. I've *refrained* from assuming that the "assignment" in the definition always has to refer to Algol 60 assignment. You're the one insisting on tying everything to Algol.

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Aaron Brady wrote: Tell me, what happens during a call to the following C++ function? void f( std::vector< int > x ); The same thing as would happen if you wrote std::vector x = actual_parameter_expression; what happens during a call to the following Python function? def f( x ): ... T

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread greg
Aaron Brady wrote: But wait, is that true assignment? It's assignment, but it's not really copying an object. No new objects are being created -- rather, some of the items within the lhs object are being rebound to already-existing objects. It would be possible for the lhs object's __setitem_

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread Aaron Brady
On Nov 21, 4:33 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Aaron Brady <[EMAIL PROTECTED]> wrote: > >> a[:] = [1, 2, 3] > > > No, that's not assignment, it's syntactic sugar for a __setslice__ > > call.  No copies here. > > Oh dear, perhaps you had better get the Python developers to update the

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread Duncan Booth
Aaron Brady <[EMAIL PROTECTED]> wrote: >> a[:] = [1, 2, 3] > > No, that's not assignment, it's syntactic sugar for a __setslice__ > call. No copies here. > Oh dear, perhaps you had better get the Python developers to update the grammar that Python uses as that seems to think it's an assignment

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread Aaron Brady
On Nov 21, 3:11 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Steven D'Aprano <[EMAIL PROTECTED]> wrote: > > On Fri, 21 Nov 2008 03:32:25 +, Steven D'Aprano wrote: > > >>> Rather it seems to me that the essence of the idea they had in mind > >>> is that call-by-value is equivalent to assignment

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-21 Thread Duncan Booth
Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Fri, 21 Nov 2008 03:32:25 +, Steven D'Aprano wrote: > >>> Rather it seems to me that the essence of the idea they had in mind >>> is that call-by-value is equivalent to assignment. >> >> You've just *assumed* that assignment in Algol 60 doesn't

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-20 Thread Steven D'Aprano
On Fri, 21 Nov 2008 03:32:25 +, Steven D'Aprano wrote: >> Rather it seems to me that the essence of the idea they had in mind is >> that call-by-value is equivalent to assignment. > > You've just *assumed* that assignment in Algol 60 doesn't involving > copying. Based on the very little I kno

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-20 Thread John Nagle
implementation or feature where assignment doesn't make a copy...) In stock ALGOL-60, there are only the primitive types, and assignment of them is a copy. Most useful implementations had strings, and Simula, which was an ALGOL extension, had objects. Simula had value parameters, r

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-20 Thread Steven D'Aprano
On Wed, 19 Nov 2008 11:20:05 -0500, Terry Reedy wrote: >> It is useful and convenient to have "null values" like None, but it >> isn't useful to say that None is not a value. > > I never said that. But you've been defending the views of somebody who did. If you're going to play Devil's Advoca

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-20 Thread Steven D'Aprano
On Thu, 20 Nov 2008 14:22:50 +1300, greg wrote: > Antoon Pardon wrote: > >> You are changing your argument. In a follow up you made the point that >> call by value should be as it was intended by the writers of the algol >> 60 report. > > No, I was countering the argument that "call by value" is

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-20 Thread Aaron Brady
On Nov 19, 7:22 pm, greg <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > > You are changing your argument. In a follow up you > > made the point that call by value should be as it > > was intended by the writers of the algol 60 report. > > No, I was countering the argument that "call by value"

Re: Finding the instance reference of an object

2008-11-19 Thread Douglas Alan
term we prefer for call-by- > value in the case where the value is an object reference (as is always > the case in Python)." Personally, I think that it is much preferable to leave "call-by-value" completely out of any such discussion, as it provably leads to a great deal of co

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-19 Thread greg
Antoon Pardon wrote: You are changing your argument. In a follow up you made the point that call by value should be as it was intended by the writers of the algol 60 report. No, I was countering the argument that "call by value" is short for "call by copying the value". I was pointing out that

Re: Finding the instance reference of an object

2008-11-19 Thread Aaron Brady
tioner 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 is an object reference (as is always   > the case in Python)." But if someone says, 'What is call-by-refere

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-19 Thread Steve Holden
[EMAIL PROTECTED] wrote: > On Nov 18, 10:22 am, Steve Holden <[EMAIL PROTECTED]> wrote > in thread "Python-URL! weekly Python news and links (Nov 17)": >> [EMAIL PROTECTED] wrote: >> [...] >>> One of the reasons I would like to formulate a good >>> model of an object's value and type is so that I c

Re: Finding the instance reference of an object

2008-11-19 Thread Craig Allen
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

Re: Finding the instance reference of an object

2008-11-19 Thread Joe Strout
the case where the value is an object reference (as is always the case in Python)." I assert that anyone who does not understand all of the above, is helping to spread confusion. I agree. Best, - Joe -- http://mail.python.org/mailman/listinfo/python-list

Re: Finding the instance reference of an object

2008-11-19 Thread Douglas Alan
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 misl

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-19 Thread Terry Reedy
Steven D'Aprano wrote: On Tue, 18 Nov 2008 15:55:10 -0500, Terry Reedy wrote: To me, that distortion of his (and my) point is silly. 0 partipipates in numerous integer operations, whereas None participates in no NoneType operations. (Neither has attributes.) And that is the difference he is

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-19 Thread Antoon Pardon
On 2008-11-19, greg <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: >> Call by value is officially defined in terms of assignment in >> a context where assignments means copying and in a definition >> of a specifix language. >> >> You can't lift this part out of the definition of algol 60 >> and

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Gabriel Genellina
efering to "anything the object carries with itself". I hope you see why I find the "value is object" to be an unacceptable explanation of Python objects. Me too. I hope the above explanation helps to understand the difference. It is based on a specific implementation, b

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Steven D'Aprano
On Tue, 18 Nov 2008 15:55:10 -0500, Terry Reedy wrote: > Steven D'Aprano wrote: >> On Sun, 16 Nov 2008 15:46:54 -0800, rurpy wrote: > >> For example, consider the two electrons around a helium nucleus. They >> have the same mass, the same speed, the same spin, the same electric >> charge, the sam

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread rurpy
On Nov 18, 10:22 am, Steve Holden <[EMAIL PROTECTED]> wrote in thread "Python-URL! weekly Python news and links (Nov 17)": > [EMAIL PROTECTED] wrote: > [...] >> One of the reasons I would like to formulate a good >> model of an object's value and type is so that I could >> try to offer something be

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread greg
Antoon Pardon wrote: Call by value is officially defined in terms of assignment in a context where assignments means copying and in a definition of a specifix language. You can't lift this part out of the definition of algol 60 and say it applies equally well in languages with different assignme

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Aaron Brady
On Nov 18, 2:55 pm, Terry Reedy <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > On Sun, 16 Nov 2008 15:46:54 -0800, rurpy wrote: > > For example, consider the two electrons around a helium nucleus. They > > have the same mass, the same speed, the same spin, the same electric > > charge, the

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Robert Kern
Terry Reedy wrote: Steven D'Aprano wrote: On Sun, 16 Nov 2008 15:46:54 -0800, rurpy wrote: For example, consider the two electrons around a helium nucleus. They have the same mass, the same speed, the same spin, the same electric charge, the same magnetic moment, they even have the same loca

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Terry Reedy
Steven D'Aprano wrote: On Sun, 16 Nov 2008 15:46:54 -0800, rurpy wrote: For example, consider the two electrons around a helium nucleus. They have the same mass, the same speed, the same spin, the same electric charge, the same magnetic moment, they even have the same location in space (tech

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread rurpy
On Nov 17, 7:35 pm, Craig Allen <[EMAIL PROTECTED]> wrote: >> >> * Do all objects have values? (Ignore the Python >> >> docs if necessary.) >> >> > If one allows null values, I am current thinking yes. >> >> I don't see a difference between a "null value" >> and not having a value. > > I think the

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Steve Holden
Steven D'Aprano wrote: > On Mon, 17 Nov 2008 18:35:04 -0800, Craig Allen wrote: > > * Do all objects have values? (Ignore the Python > docs if necessary.) If one allows null values, I am current thinking yes. >>> I don't see a difference between a "null value" and not having a value.

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Antoon Pardon
On 2008-11-12, greg <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > >> Why should anyone take the "Revised Report on the Algorithmic Language >> Algol 60" as the "official" (only?) definition of call-by-value for all >> languages everywhere? > > Since the term was more or less invented by t

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Steven D'Aprano
semantics for me to have attempted to > redefine it, even if it is the word used (but not defined) in the Python > Reference Manual. It shouldn't need definition, since it already has a perfectly fine definition in the dictionary. It would only need an alternative definition if the dictionar

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Aaron Brady
On Nov 18, 2:21 am, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2008-11-12, greg <[EMAIL PROTECTED]> wrote: > > > Here is the definition of call-by-value from the > > "Revised Report on the Algorithmic Language Algol 60" > >: > > > 4.7.3.1. Value assignm

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-18 Thread Antoon Pardon
On 2008-11-12, greg <[EMAIL PROTECTED]> wrote: > Here is the definition of call-by-value from the > "Revised Report on the Algorithmic Language Algol 60" >: > > 4.7.3.1. Value assignment (call by value). All formal parameters quoted in > the > value part

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-17 Thread Steven D'Aprano
On Mon, 17 Nov 2008 18:35:04 -0800, Craig Allen wrote: >> >> * Do all objects have values? (Ignore the Python >> >> docs if necessary.) >> >> > If one allows null values, I am current thinking yes. >> >> I don't see a difference between a "null value" and not having a value. >> >> > I think the d

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-17 Thread Steven D'Aprano
On Sun, 16 Nov 2008 23:34:58 -0500, Terry Reedy wrote: > Steven D'Aprano wrote: > class EqualsAll(object): >> ... def __eq__(self, other): >> ... return True >> ... > 5 == EqualsAll() >> True >> >> >> The methods of 5 don't even get called. > > Why do you say that? As

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-17 Thread Aaron Brady
On Nov 17, 8:35 pm, Craig Allen <[EMAIL PROTECTED]> wrote: > > >> * Do all objects have values? (Ignore the Python > > >>  docs if necessary.) > > > > If one allows null values, I am current thinking yes. > > > I don't see a difference between a "null value" > > and not having a value. > > I think

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-17 Thread Craig Allen
> >> * Do all objects have values? (Ignore the Python > >> docs if necessary.) > > > If one allows null values, I am current thinking yes. > > I don't see a difference between a "null value" > and not having a value. > I think the difference is concrete... an uninitialized variable in C has no va

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Or one could adopt what Terry Reedy called a 4-aspect view: an object is identity, class, value (or local-state or something) and intrinsic-value. What I specifically said is id, class, instance attributes, and private data. So objects have only one, some only the ot

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread rurpy
On Nov 16, 5:12 pm, Steve Holden <[EMAIL PROTECTED]> wrote: >> The Python Reference Manual states that an object >> consists of identity, type, and value. "Identity" >> seems to be non-controversial. >> >> Let's take "type" as meaning

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Terry Reedy
Steven D'Aprano wrote: Because of Python's interpreted nature, names can't be compiled away as in C, they need a concrete runtime existence, but does the language definition need to assume that? Of course. It wouldn't be Python if they didn't. However, remember that objects don't have names.

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Steve Holden
have attempted > to redefine it, even if it is the word used > (but not defined) in the Python Reference > Manual. > > Let me try again, in a slightly different > way and using slightly different terminology > in the hope we can avoid the fascinating > but basically irreleva

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread rurpy
d (but not defined) in the Python Reference Manual. Let me try again, in a slightly different way and using slightly different terminology in the hope we can avoid the fascinating but basically irrelevant philosophical digressions into form and ideal, the nature of nothingness, etc. :-) Suppose

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Steve Holden
Steven D'Aprano wrote: > On Sat, 15 Nov 2008 11:17:07 -0800, rurpy wrote: [...] >> * How can I find an object's value (if I don't believe >> .str(), .repr(), etc)? Use gdb. :-) > > I would say the object's value is the value, so if you have the object, > you have its value. > [...] There's a

Re: Official definition of call-by-value (Re: Finding the instance reference...)

2008-11-16 Thread Steve Holden
Steven D'Aprano wrote: > On Sat, 15 Nov 2008 19:42:33 -0800, rurpy wrote: [...] >> But I propose that one can define value in a precise way that >> captures what most people think of as value, and avoids confusing >> objects (or references to them) and the value of objects. > > Good luck. I think

<    5   6   7   8   9   10   11   12   13   14   >