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
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__',
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
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