Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
intercepting methods
#1
intercepting/replacing (or adding) methods of existing builtin types is something i have generally wanted to do.  an example of what i mean is to replace the __repr__ method of type int (and long in python2) to convert in hexadecimal instead of decimal.  by adding i mean adding, to the class as a whole, not individual object instances, a new method attribute.

is this doable without hacking the interpreter source?  example types i want to do this with include bool, int, long, float.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020