diff options
author | Guido van Rossum <guido@python.org> | 1992-09-12 11:09:23 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-09-12 11:09:23 (GMT) |
commit | 1899c2e0550fa025080e35bb3ec25aeff0118dc7 (patch) | |
tree | 46cf91828dd59c33ef396e1cdb93ce4ada5c8d9e /Objects/classobject.c | |
parent | 5c85062e1ce4c7e51daaad1a4eb3f66f6b5a0ea8 (diff) | |
download | cpython-1899c2e0550fa025080e35bb3ec25aeff0118dc7.zip cpython-1899c2e0550fa025080e35bb3ec25aeff0118dc7.tar.gz cpython-1899c2e0550fa025080e35bb3ec25aeff0118dc7.tar.bz2 |
Made builtins int(), long(), float(), oct() and hex() more generic.
Diffstat (limited to 'Objects/classobject.c')
-rw-r--r-- | Objects/classobject.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c index 514869c..9026968 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -714,6 +714,12 @@ instance_coerce(pv, pw) return 0; } +UNARY(instance_int, "__int__") +UNARY(instance_long, "__long__") +UNARY(instance_float, "__float__") +UNARY(instance_oct, "__oct__") +UNARY(instance_hex, "__hex__") + static number_methods instance_as_number = { instance_add, /*nb_add*/ instance_sub, /*nb_subtract*/ @@ -733,6 +739,11 @@ static number_methods instance_as_number = { instance_xor, /*nb_xor*/ instance_or, /*nb_or*/ instance_coerce, /*nb_coerce*/ + instance_int, /*nb_int*/ + instance_long, /*nb_long*/ + instance_float, /*nb_float*/ + instance_oct, /*nb_oct*/ + instance_hex, /*nb_hex*/ }; typeobject Instancetype = { |