[Tutor] Increase performance of the script
Peter Otten
__peter__ at web.de
Wed Dec 12 05:04:01 EST 2018
Steven D'Aprano wrote:
> [...]
>> In python 2.6 print statement work as print "Solution"
>> however after import collection I have to use print with
>> print("Solution") is this a known issue ?
>
> As Peter says, you must have run
>
> from __future__ import print_function
>
> to see this behaviour. This has nothing to do with import collection.
> You can debug that for yourself by exiting the interactive interpreter,
> starting it up again, and trying to print before and after importing
> collection.
To be fair to Asad -- I sneaked in the __future__ import into my sample
code. I did it to be able to write Python 3 code that would still run in his
2.6 interpreter.
In hindsight that was not a good idea as it can confuse someone who has
never seen it, and the OP has yet to learn other more important things.
More information about the Tutor
mailing list