Rustom Mody wrote: > On Thursday, October 9, 2014 10:26:41 AM UTC+5:30, Steven D'Aprano wrote: >> On Wed, 08 Oct 2014 19:34:30 -0700, Rustom Mody wrote: > >> >>>> Color.Red >> >>>> print (Color.Red) >> > Color.Red >> > # Not sure what to make of that distinction... > >> That's because the interactive interpreter displays the repr() of objects >> (except for None, which it suppresses), while print outputs the str() of >> them. > > Yeah... > > What I meant to wonder upon was: "Is this behavior what the pro-print or > the anti-print folks like?" > > In any case that the P in REPL is not *exactly* the same as print > (or equivalently the distinction between str and repr) makes for some > intricate noob confusions. > > 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 -- https://mail.python.org/mailman/listinfo/python-list