Re: Id of methods

2012-02-09 Thread bruno.desthuilli...@gmail.com
On Feb 9, 5:06 am, Chris Angelico wrote: > On Thu, Feb 9, 2012 at 2:48 PM, Emeka wrote: > > > My question is why is it that the id of Boo.daf  is different from daf's hex > > value in the above dict? > > > daf is not a function, it's a special object for an unbound method. http://wiki.python.org

Re: Id of methods

2012-02-08 Thread Terry Reedy
On 2/8/2012 10:48 PM, Emeka wrote: class Boo(object): def __init__(self , moon, sun): self.moon = moon self.sun = sun def daf(self): return self.sun + self.moon def ball(self): return self.sun * self.moon print Boo.__dict__ {'__module__': '__main__',

Re: Id of methods

2012-02-08 Thread Chris Angelico
On Thu, Feb 9, 2012 at 2:48 PM, Emeka wrote: > I am trying to see if I could get more of Python without being insane. Oh, I thought insanity was a prerequisite... anyway. > print Boo.__dict__ > > {'__module__': '__main__', 'ball': , 'daf': > , '__dict__ ..} > > print  hex(id(Boo.daf)) > 0x27

Id of methods

2012-02-08 Thread Emeka
Hell All, I am trying to see if I could get more of Python without being insane. class Boo(object): def __init__(self , moon, sun): self.moon = moon self.sun = sun def daf(self): return self.sun + self.moon def ball(self): return self.sun * self.moon print B