java2python
java2python copied to clipboard
assignment expressions in while loop
Hello,
I'll put some feed back here to some missing conversions. I hope it can be useful.
A java code like this:
int amountRead;
while((amountRead = is.read(buffer, 0, 1024))!= -1)
{
decoded.write(buffer, 0, amountRead);
}
decoded.flush();
is converted to this python one:
amountRead = int()
while (amountRead = is_.read(buffer_, 0, 1024)) != -1:
decoded.write(buffer_, 0, amountRead)
decoded.flush()
The problem is that Python doesn't allow assignment expressions to be used inside the conditional expression of the loop. Check here: expression vs assignments in while loop in python and Java?