Skip to content

Conversation

@KeyWeeUsr
Copy link
Member

Don't know about linux/mac, but on win there is this output on garden install <something>:

print(something, something) returns tuple

('Progression', 1024, '|', '\r')
('Progression', 2048, '/', '\r')
('Progression', 3072, '-', '\r')
('Progression', 4096, '\\', '\r')
('Progression', 5120, '|', '\r')
('Progression', 6144, '/', '\r')
('Progression', 7168, '-', '\r')
('Progression', 8192, '\\', '\r')
('Progression', 9216, '|', '\r')

which is fixed by this PR. However, as you can see, \r won't rewrite the line in something like cmd.exe(didn't try with powershell). Is it intended behavior?

@AndiEcker
Copy link

Ín my Windows 7 machine the \r character is correctly rewriting the line in CMD.EXE but for that you'd also need to pass an empty string onto the end parameter to the print() function. Or you could alternatively also specify the end argument of the print function as: , end='\r' - see also http://stackoverflow.com/questions/17391437/how-to-use-r-to-print-on-same-line

print('Progression', count, animation[index % len(animation)], '\r')
print(' '.join([str(x) for x in ('Progression', count,
animation[index % len(animation)], '\r')]))
sys.stdout.flush()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking a bit complicated. '{} {} {} {}'.format('Progression', count, animation[index % len(animation)], '\r') is probably better.

@KeyWeeUsr
Copy link
Member Author

KeyWeeUsr commented Jun 18, 2016

@AndiEcker Yes I know about that, but print is still a statement in python2, therefore no end= is available. I wanted it to behave in a similar way and support even those old versions such as 2.3.5.

@matham Yup, looked ugly, but the reason is here ↑, anyway I looked into python docs and format is available since 2.6(and there's a lot of format() in garden), so the solution doesn't actually matter, because I can take python function from __future__ instead and it'll work as in py3. ✌️ I added only import from __future__ so that #16 could be merged too as it's already there since May.

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

Successfully merging this pull request may close these issues.

3 participants