Re: Object Reference question

2009-09-01 Thread Bruno Desthuilliers
Ethan Furman a écrit : (snip) The best answer I can give is that you do not want to use 'name' to reference the object itself, but only for printing/debugging purposes. Which is what the OP stated !-) 'name' is just a label for your object, and not necessarily the only label; that

Re: Object Reference question

2009-08-31 Thread Ethan Furman
josef wrote: On Aug 27, 1:35 pm, Ethan Furman et...@stoneleaf.us wrote: josef wrote: Thanks to everyone who responded. I will be going with some sort of a = MyClass(name = 'a') format. It's the Python way. For me, it was very hard to accept that EVERYTHING is an object reference. And

Re: Object Reference question

2009-08-28 Thread josef
On Aug 27, 1:35 pm, Ethan Furman et...@stoneleaf.us wrote: josef wrote: Thanks to everyone who responded. I will be going with some sort of a = MyClass(name = 'a') format. It's the Python way. For me, it was very hard to accept that EVERYTHING is an object reference. And that there

Re: Object Reference question

2009-08-27 Thread josef
Thanks to everyone who responded. I will be going with some sort of a = MyClass(name = 'a') format. It's the Python way. For me, it was very hard to accept that EVERYTHING is an object reference. And that there are no object reference names, just string entries in dictionaries. But I think it

Re: Object Reference question

2009-08-27 Thread Ethan Furman
josef wrote: Thanks to everyone who responded. I will be going with some sort of a = MyClass(name = 'a') format. It's the Python way. For me, it was very hard to accept that EVERYTHING is an object reference. And that there are no object reference names, just string entries in dictionaries.

Re: Object Reference question

2009-08-26 Thread Hendrik van Rooyen
On Tuesday 25 August 2009 21:32:09 Aahz wrote: In article mailman.164.1250837108.2854.python-l...@python.org, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Friday 21 August 2009 08:07:18 josef wrote: My main focus of this post is: How do I find and use object reference memory

Re: Object Reference question

2009-08-25 Thread Aahz
In article mailman.164.1250837108.2854.python-l...@python.org, Hendrik van Rooyen hend...@microcorp.co.za wrote: On Friday 21 August 2009 08:07:18 josef wrote: My main focus of this post is: How do I find and use object reference memory locations? a = [1,2,3,4] id(a) 8347088 Of course,

Re: Object Reference question

2009-08-24 Thread Bruno Desthuilliers
josef a écrit : (snip) I think that something like a = MyClass0(name = 'a', ...) is a bit redundant. Are definitions treated the same way? How would one print or pass function names? In Python, classes and functions are objects too. The class and def statements are mostly syntactic sugar

Re: Object Reference question

2009-08-21 Thread Miles Kaufmann
On Aug 20, 2009, at 11:07 PM, josef wrote: To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a Pass By Object Reference model. x = 1 x becomes the object reference, while an object is created with the type

Re: Object Reference question

2009-08-21 Thread Chris Rebert
On Thu, Aug 20, 2009 at 11:34 PM, Miles Kaufmannmile...@umich.edu wrote: On Aug 20, 2009, at 11:07 PM, josef wrote: snip The following is what I would like to do: I have a list of class instances dk = [ a, b, c, d ], where a, b, c, d is an object reference. Entering dk gives me the object:

Re: Object Reference question

2009-08-21 Thread Hendrik van Rooyen
On Friday 21 August 2009 08:07:18 josef wrote: My main focus of this post is: How do I find and use object reference memory locations? a = [1,2,3,4] id(a) 8347088 - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Object Reference question

2009-08-21 Thread josef
On Aug 21, 1:34 am, Miles Kaufmann mile...@umich.edu wrote: On Aug 20, 2009, at 11:07 PM, josef wrote: To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a Pass By Object Reference model. x = 1 x

Re: Object Reference question

2009-08-21 Thread Dave Angel
josef wrote: To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a Pass By Object Reference model. x = 1 x becomes the object reference, while an object is created with the type 'int', value 1, and identifier

Re: Object Reference question

2009-08-21 Thread Bruno Desthuilliers
josef a écrit : To begin, I'm new with python. I've read a few discussions about object references and I think I understand them. To be clear, Python uses a Pass By Object Reference model. x = 1 x becomes the object reference, while an object is created with the type 'int', value 1, and

Re: Object Reference question

2009-08-21 Thread Ben Finney
josef jos...@gmail.com writes: To be clear, Python uses a Pass By Object Reference model. Yes. (I'm glad this concept has propagated to newcomers so well :-) x = 1 x becomes the object reference It becomes *a* reference to that object, independent of any other references to that same

Re: Object Reference question

2009-08-21 Thread josef
On Aug 21, 4:26 am, Ben Finney ben+pyt...@benfinney.id.au wrote: josef jos...@gmail.com writes: To be clear, Python uses a Pass By Object Reference model. Yes. (I'm glad this concept has propagated to newcomers so well :-) I found one really good discussion on python semantics versus other

Re: Object Reference question

2009-08-21 Thread Ben Finney
josef jos...@gmail.com writes: On Aug 21, 4:26 am, Ben Finney ben+pyt...@benfinney.id.au wrote: Note that, after that list is created, each item in that list is *also* a reference to the corresponding object. That is, ‘a’ is a reference to an object, and ‘dk[0]’ is a *different* reference