Hi,

Yes sorry it should have been float(tmp).


Yes, could be added to the java code, and if it's complex its probably not an 
issue in many cases.

Regards
/Petrus


On 14 Dec 2013, at 20:59 , Andi Vajda <va...@apache.org> wrote:

> 
>> On Dec 14, 2013, at 16:46, Petrus Hyvönen <petrus.hyvo...@gmail.com> wrote:
>> 
>> Hi!
>> 
>> I am converting some java code to python scripts, using a JCC wrapped 
>> library.
>> 
>> One thing that strikes me is that java seems to have a automatic typecast of 
>> int to float, which is not present in the JCC wrapped library.
>> 
>> i.e. if a tmp=100 and obj.shift(tmp) is executed, and the method expects a 
>> float, it seems to fail in the wrapped code while working in java. Of course 
>> it can be explicitly typed obj.shift((float) tmp) but it does look as 
>> readable.
> 
> In python, no, that syntax is incorrect. But you could use 100.0 instead of 
> 100. Almost as readable. Or add an intermediate method that casts to float.
> 
> Could that feature be added to jcc ? sure, but it gets complicated fast. If 
> you control both ends of the app (the python and the java code), it's easiest 
> to add an int overload to the shift method and call the float version.
> 
> Andi..
> 
>> 
>> This is a minor thing, but could it be enabled so that this automatic 
>> conversion from int to floats are done if no other matching signatures are 
>> found? (I assume this is the way java works, I'm no java expert..) 
>> 
>> Many thanks
>> /Petrus
>> 

Reply via email to