How about adding rational fraction to Python?

Paul Rubin http
Sun Mar 2 17:35:33 EST 2008


Jeff Schwab <jeff at schwabcenter.com> writes:
> Better yet, how hard would it be to define an otherwise int-like type
> that did not define a non-flooring division operator?  Are there any
> real use cases for such a type?

User defined types in python are fairly heavyweight compared with the
built-in types, and a type like that is just another thing for the
user to have to remember.

The C library has a bunch of different types like off_t (offset in a
file) and size_t, so if you pass an off_t to a function that expects a
size_t as that arg, the compiler notices the error.  But they are
really just integers and they compile with no runtime overhead.

So, I think Python won't easily support lots of different types of
integers, and we've got what we've got.  

There's an interesting talk linked from LTU about future languages:

  http://lambda-the-ultimate.org/node/1277



More information about the Python-list mailing list