Java is killing me! (AKA: Java for Pythonheads?)
Alain Ketterlin
alain at dpt-info.u-strasbg.fr
Fri Aug 12 13:45:47 EDT 2011
kj <no.email at please.post> writes:
[...]
> def quant(xs, nlevels=MAXN, xlim=MAXX):
[...]
> My Java implementation of it already requires at least 8 method
> definitions, with signatures:
(BTW, your approach won't work if several optionals have the same type.)
[...]
- use Integer, Float, etc. everywhere. The compiler will box primitive
types as needed at call sites
- re. default values (on positional params), use null to indicate a use
of the default, or use ellipsis, or use class-provided static fields
at call sites, or use a special class to represent all the optional
parameters
- re. named parameters with default, use a map, or change the call sites
to remove them
-- Alain.
More information about the Python-list
mailing list