Python 3: print statement -> print function - #9664
Conversation
4559d9b to
808e039
Compare
| hook=NVDAHelper.localLib.dllImportTableHooks_hookSingle(targetDll,importDll,funcName,newFunction) | ||
| if hook: | ||
| print "hooked %s"%funcName | ||
| print("hooked %s"%funcName) |
There was a problem hiding this comment.
Actually, the print statements in this file should have always been log.debug calls. Currently they are just noise going to stdout.
|
Hi, I was wondering for a while why there was a print statement… now we know – change will be done in a moment. Thanks for this clarification.
|
michaelDCurran
left a comment
There was a problem hiding this comment.
I would prefer this to go straight to threshold rather than master, unless @feerrenrut instructed otherwise?
Reasoning is that although
print("hello")
Does syntactitally work in Python 2, this is more just a side afect due to the print statement allowing no whitespace between the keyword and a following tuple.
If you try to do things like provide multiple arguments, you see that it literally prints a tuple, and if you try giving it Python 3 keyword arguments, you get a syntax error.
So I think adding it to master now is miss-leading.
Of course in Python 2 we could do:
from __future__ import print_function
But we'll then have to remove that line as soon as threshold is merged to master anyway.
|
Hi, CC @LeonarddeR
|
…g crash dump path.
…ing function hooks.
Reviewed and clarified by Mick Curran (NV Access): print function should have been a log.debug call.
7d9fc3f to
1d2aac4
Compare
|
Hi, Done - sorry for rebases and forced commits. Thanks. |
|
Mick has a valid point here. Switching back to Threshold makes sense.
|
feerrenrut
left a comment
There was a problem hiding this comment.
Looks good, also on this PR, please outline the process used.
|
Hi, Process used:
Thanks. |
Link to issue number:
None
Summary of the issue:
In python 3, print keyword is now a function.
Description of how this pull request fixes the issue:
Changes occurrence of "print" statement to a function. Note that this one is also applicable to Python 2, but it is based on Project Threshold/Python 3 assumptions.
Testing performed:
Tested multiple times on source copy of Python 3 NVDA, Python 2 and 3 interpreter, and current NVDA alpha release.
Known issues with pull request:
None
Change log entry:
None