[Python-Dev] quick poll: could int, str, tuple etc. become type objects?

Skip Montanaro skip@pobox.com (Skip Montanaro)
Tue, 5 Jun 2001 15:56:58 -0500


Is the intent of using int and friends as constructors instead of just
coercion functions that I should (eventually) be able to do this:

    class NonNegativeInt(int):
        def __init__(self, val):
	    if int(val) < 0:
	        raise ValueError, "Value must be >= 0"
	    int.__init__(self, val)
	    self.a = 47
        ...

?

Skip