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 particul

Re: Object Reference question

2009-08-31 Thread Ethan Furman
josef wrote: On Aug 27, 1:35 pm, Ethan Furman 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 are no ob

Re: Object Reference question

2009-08-28 Thread josef
On Aug 27, 1:35 pm, Ethan Furman 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 are no o

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. But

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 all

Re: Object Reference question

2009-08-25 Thread Hendrik van Rooyen
On Tuesday 25 August 2009 21:32:09 Aahz wrote: > In article , > > Hendrik van Rooyen 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 >

Re: Object Reference question

2009-08-25 Thread Aahz
In article , Hendrik van Rooyen 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, that doesn't actually allow you to do anything... -

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 th

Re: Object Reference question

2009-08-21 Thread Ben Finney
josef writes: > On Aug 21, 4:26 am, Ben Finney 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 to > > the *same* object. The object

Re: Object Reference question

2009-08-21 Thread Simon Forman
On Aug 21, 12:12 pm, josef wrote: > > > I need the object reference name (a,b,c,d) from dk to use as input for > > > a file. > > > You'll have to track that yourself. > > I'm a bit shocked that there isn't a method for catching object > reference names. I think that something like a = MyClass0(nam

Re: Object Reference question

2009-08-21 Thread josef
On Aug 21, 4:26 am, Ben Finney wrote: > josef 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 languages. It gave me this gem of a q

Re: Object Reference question

2009-08-21 Thread Simon Forman
On Aug 21, 2:07 am, 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 > ty

Re: Object Reference question

2009-08-21 Thread Ben Finney
josef 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 object. > while a

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 identi

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 identifie

Re: Object Reference question

2009-08-21 Thread josef
On Aug 21, 1:34 am, Miles Kaufmann 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 beco

Re: Object Reference question

2009-08-20 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-20 Thread Chris Rebert
On Thu, Aug 20, 2009 at 11:34 PM, Miles Kaufmann wrote: > On Aug 20, 2009, at 11:07 PM, josef wrote: >> 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: [MyClass0 >> insta

Re: Object Reference question

2009-08-20 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 typ

Object Reference question

2009-08-20 Thread josef
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 (id(x)). Doin