Re: object query assigned variable name?

2009-05-06 Thread Aaron Brady
On May 6, 12:56 am, John O'Hagan wrote: > On Tue, 5 May 2009, Sion Arrowsmith wrote: > > John O'Hagan   wrote: > > >I can see that it's tantalizing, though, because _somebody_ must know > > > about the assignment; after all, we just executed it! > > > Except we haven't, if we're talking about repo

Re: object query assigned variable name?

2009-05-06 Thread Piet van Oostrum
> John O'Hagan (JO) wrote: >JO> I guess what I meant was that if I type: >JO> brian = Brian() >JO> in the python shell and then hit return, it seems to me that >JO> _somewhere_ (in the interpreter? I have no idea how it's done) it >JO> must be written that the new Brian object will later be

Re: object query assigned variable name?

2009-05-06 Thread Sion Arrowsmith
John O'Hagan wrote: >I guess what I meant was that if I type: > >brian = Brian() > >in the python shell and then hit return, it seems to me that _somewhere_ (in >the interpreter? I have no idea how it's done) it must be written that the >new Brian object will later be assigned the name "brian",

Re: object query assigned variable name?

2009-05-05 Thread John O'Hagan
On Tue, 5 May 2009, Sion Arrowsmith wrote: > John O'Hagan wrote: > >I can see that it's tantalizing, though, because _somebody_ must know > > about the assignment; after all, we just executed it! > > Except we haven't, if we're talking about reporting from the > > object's __init__: > >>> class B

Re: object query assigned variable name?

2009-05-05 Thread Sion Arrowsmith
John O'Hagan wrote: >I can see that it's tantalizing, though, because _somebody_ must know about >the assignment; after all, we just executed it! Except we haven't, if we're talking about reporting from the object's __init__: >>> class Brian: ... def __init__(self): ... print "I'm

Re: object query assigned variable name?

2009-05-03 Thread John O'Hagan
On Sat, 2 May 2009, John O'Hagan wrote: > On Fri, 1 May 2009, warpcat wrote: [...] > > Given an object: > > > > class Spam(object): > > def __init__(self): > > # stuff > > > > I'd like it to print, when instanced, something like this: > > >>> s = Spam() > > > > I’m assigned to s!

Re: object query assigned variable name?

2009-05-02 Thread David Stanek
On Fri, May 1, 2009 at 12:48 PM, Steven D'Aprano wrote: > On Fri, 01 May 2009 09:24:10 -0700, warpcat wrote: > >> I'd like it to print, when instanced, something like this: >> > s = Spam() >> I’m assigned to s! >> >> But it seems prohibitively hard (based on my web and forum searches) for >> a

Re: object query assigned variable name?

2009-05-01 Thread John O'Hagan
On Fri, 1 May 2009, warpcat wrote: > I've passed this around some other groups, and I'm being told > "probably not possible". But I thought I'd try here as well :) I > *did* search first, and found several similar threads, but they > quickly tangented into other specifics of the language that we

Re: object query assigned variable name?

2009-05-01 Thread Nick Craig-Wood
warpcat wrote: > I've passed this around some other groups, and I'm being told > "probably not possible". But I thought I'd try here as well :) I > *did* search first, and found several similar threads, but they > quickly tangented into other specifics of the language that were a bit > ove

Re: object query assigned variable name?

2009-05-01 Thread Steven D'Aprano
On Fri, 01 May 2009 13:03:56 -0400, David Robinow wrote: > Others have explained to you that this is not possible. I'll just point > out that your method for learning the language is not optimal. If you > had gotten a recipe to do what you asked, how would it help you write > better programs? Exa

Re: object query assigned variable name?

2009-05-01 Thread AKEric
On May 1, 10:03 am, David Robinow wrote: > On Fri, May 1, 2009 at 12:24 PM, warpcat wrote: > > I've passed this around some other groups, and I'm being told > > "probably not possible".  But I thought I'd try here as well :)   I > > *did* search first, and found several similar threads, but they

Re: object query assigned variable name?

2009-05-01 Thread AKEric
On May 1, 9:48 am, Steven D'Aprano wrote: > On Fri, 01 May 2009 09:24:10 -0700, warpcat wrote: > > I'd like it to print, when instanced, something like this: > > s = Spam() > > I’m assigned to s! > > > But it seems prohibitively hard (based on my web and forum searches) for > > an object to k

Re: object query assigned variable name?

2009-05-01 Thread David Robinow
On Fri, May 1, 2009 at 12:24 PM, warpcat wrote: > I've passed this around some other groups, and I'm being told > "probably not possible".  But I thought I'd try here as well :)   I > *did* search first, and found several similar threads, but they > quickly tangented into other specifics of the la

Re: object query assigned variable name?

2009-05-01 Thread Steven D'Aprano
On Fri, 01 May 2009 09:24:10 -0700, warpcat wrote: > I'd like it to print, when instanced, something like this: > s = Spam() > I’m assigned to s! > > But it seems prohibitively hard (based on my web and forum searches) for > an object to know what variable name is has been assigned to when

Re: object query assigned variable name?

2009-05-01 Thread Scott David Daniels
warpcat wrote: I've passed this around some other groups, and I'm being told "probably not possible". But I thought I'd try here as well :) ... Given an object: class Spam(object): def __init__(self): # stuff I'd like it to print, when instanced, something like this:

object query assigned variable name?

2009-05-01 Thread warpcat
I've passed this around some other groups, and I'm being told "probably not possible". But I thought I'd try here as well :) I *did* search first, and found several similar threads, but they quickly tangented into other specifics of the language that were a bit over my head :) At any rate, here