On 13/05/07, Marilyn Davis <[EMAIL PROTECTED]> wrote:
> #!/usr/bin/env python
> '''An Under10 class, just to fiddle with inheriting from int.'''
>
> class Under10(int):
>
>     def __init__(self, number):
>         number %= 10
>         int.__init__(self, number)

Subclassing int and other types is a bit special.  Check out this
page; it may help you:
http://www.python.org/download/releases/2.2.3/descrintro/#__new__

--
John.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to