[Python-ideas] print in the interactive interpreter? plus shell API idea
rnd at onego.ru
Sun Jul 6 17:49:59 CEST 2008
Oleg Broytmann wrote:
> 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
>>>> '' or None
>>>> print ['тест']
Python 2.5.2 (r252:60911, Apr 21 2008, 11:12:42)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print ['тест']
> Note the difference.
Can't see any difference in the latter example (matter of encodings, I
guess), however, None is treated specially, it is true.
At any rate, repr or not, its more typing to get the "nicer" result.
My point is that the shell could be more sophisticated.
More information about the Python-ideas