Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assignment expressions in while loop #45

Open
yucer opened this issue Sep 27, 2016 · 0 comments
Open

assignment expressions in while loop #45

yucer opened this issue Sep 27, 2016 · 0 comments

Comments

@yucer
Copy link

yucer commented Sep 27, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant