Yuan Yijun (bbbush) wrote,
Yuan Yijun
bbbush

python 3 的 print 啊...

原来 python 2.5

[yuan@mstar ~]$ python
Python 2.5.1 (r251:54863, Aug 28 2007, 09:58:30)
[GCC 4.1.2 20070821 (Red Hat 4.1.2-19)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> type(print)
  File "<stdin>", line 1
    type(print)
             ^
SyntaxError: invalid syntax
>>> help(print)
  File "<stdin>", line 1
    help(print)
             ^
SyntaxError: invalid syntax
>>> print "abc"
abc
>>> print

>>>

现在呢

[yuan@mstar ~]$ python3.0
Python 3.0a1 (py3k, Sep  2 2007, 00:35:47)
[GCC 4.1.2 20070821 (Red Hat 4.1.2-19)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> type(print)
<type 'builtin_function_or_method'>
>>> help(print)

>>> print "abc"
  File "<stdin>", line 1
    print "abc"
              ^
SyntaxError: invalid syntax
>>> print
<built-in function print>
>>> print("abc")
abc
>>>


又,从 http://ivazquez.livejournal.com/2436.html 这里搞到的 srpm,稍微改一点,刚装上。 看 pep 3099 了, http://www.python.org/dev/peps/pep-3099/ 还有 pep 3000 http://www.python.org/dev/peps/pep-3000/ ,觉得个人喜好真是够让人热血

不知道什么时候会有 alternatives 切换的 python,不过很有可能不会那么搞,而只是这样简单的打个包了事,反正针对这个分支的代码还少。
Tags: fedora, python
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments