Id of methods

Emeka emekamicro at
Thu Feb 9 04:48:25 CET 2012

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 Boo.__dict__

{'__module__': '__main__', 'ball': <function ball at 0x286e9b0>, 'daf':
<function daf at 0x286e938>, '__dict__ ......}

print  hex(id(Boo.daf))

My question is why is it that the id of Boo.daf  is different from daf's
hex value in the above dict?

Regards, \Emeka
*Satajanus  Nig. Ltd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list