Add methods to int?

Michael Hudson mwh at python.net
Thu Jun 17 13:09:45 CEST 2004


Reinhold Birkenfeld <reinhold-birkenfeld-nospam at wolke7.net> writes:

> Peter Otten wrote:
> 
> > int and str have no __dict__, neither in the class nor instance, and hence
> > no place to store your additions: 
> > 
> >>>> "__dict__" in dir(4)
> > False
> >>>> "__dict__" in dir(4 .__class__) 
> > False
> 
> So why does "print int.__dict__" produce a value?

>>> "__dict__" in dir(4 .__class__.__class__)
True

:-)

Cheers,
mwh

-- 
  If Unicode is a horde of zombies with flaming dung sticks, 
  the hideous intricacies of JIS, Chinese Big-5, Chinese 
  Traditional, KOI-8, et cetera are at least an army of ogres 
  with salt and flensing knives.        -- Eric S. Raymond, python-dev



More information about the Python-list mailing list