Toggle
Terry Reedy
tjreedy at udel.edu
Thu Oct 9 16:57:08 EDT 2014
On 10/9/2014 8:42 AM, Rustom Mody wrote:
> On Thursday, October 9, 2014 1:21:49 PM UTC+5:30, Peter Otten wrote:
>> Rustom Mody wrote:
>>> BTW is there some flag that can make them identical?
>
>> No flag, but you can tweak that P:
>
>>>>> import sys
>>>>> sys.displayhook = print
>>>>> "foo"
>> foo
>>>>> def f(): pass
>> ...
>>>>> f()
>> None
>
> Yeah. Thats what I was looking for -- thanks!
>
> With print as above:
>
>>>> "Hello World\n"
> Hello World
> With default displayhook:
>
>>>> "Hello World\n"
> 'Hello World\n'
For anyone wondering, the reason for the default behavior is to avoid
ambiguity between ints and strings containing digits.
>>> print(123)
123
>>> print('123')
123
>>> '123'
'123'
--
Terry Jan Reedy
More information about the Python-list
mailing list