On Tue, May 11, 2010 at 6:38 PM, Richard Lamboj
<richard.lam...@bilcom.at> wrote:
> i want to inherit from a data type. How can i do this? Can anyone explain more
> abou this? How knows python that it is a float, or a string?

$ python
Python 2.6.5 (r265:79063, Apr 27 2010, 18:26:49)
[GCC 4.4.1 (CRUX)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> class MyFloat(float):
...     def __repr__(self):
...             return "MyFloat(%f)" % self
...
>>> x = MyFloat(3.1415926535897931)
>>> x
MyFloat(3.141593)
>>>

--James
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to