[Python-ideas] print in the interactive interpreter? plus shell API idea

Oleg Broytmann phd at phd.pp.ru
Sun Jul 6 16:31:47 CEST 2008


On Sun, Jul 06, 2008 at 12:22:17PM +1200, Greg Ewing wrote:
> Roman Susi wrote:
> 
> >Before it were simple to print something with print. Now extra ( and )
> >are needed and also extra caution.
> 
> How often does one really need to use print in the interactive
> shell, given than you can just type an expression and get
> the repr of the result?

   It is is not always repr():

$  python
Python 2.5 (release25-maint, Dec  9 2006, 14:35:53) 
[GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-20)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print '' or None
None
>>> '' or None
>>> print ['тест']
['\xd4\xc5\xd3\xd4']
>>> ['тест']
['тест']

   Note the difference.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.


More information about the Python-ideas mailing list