Python less error-prone than Java

Alan Morgan amorgan at xenon.Stanford.EDU
Sun Jun 4 01:12:52 EDT 2006


In article <3Vtgg.2967$ap3.12 at news-server.bigpond.net.au>,
Neil Hodgson  <nyamatongwe+thunder at gmail.com> wrote:
>Alan Morgan wrote:
>
>> Since Java doesn't allow function overloading that clearly can't be
>> the way.  J2SE 5.0 allows generic classes and functions that operate
>> on generic containers.  There are some gotchas, but it's not drastically
>> more complex than the original int-only java code.
>
>    Doesn't Java restrict generics to only operate on reference types so 
>you can't produce a generic binary search that operates on arrays where 
>the item type may be int?

Yup, you have to wrap int (and double and float and...).  Blame type
erasure.

Alan
-- 
Defendit numerus



More information about the Python-list mailing list