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

  • 脸盲测试

    Results Out of 72 faces, you correctly identified 51. In other words, you got 71% correct. On our previous version of this test, the…

  • (no subject)

    http://blog.farmostwood.net/politics_bdwm 政治立场坐标(左翼<->右翼)0.1,经济立场坐标(左翼<->右翼)0,文化立场坐标(保守<->自由)0.5…

  • profiling

    xml: 374K xsl: 71K AltovaXML 不使用 xsl:key 的时候,需要查询 4k 次数据,耗时 45s+ 使用 xsl:key 的时候 xslt2: real 0m11.102s user 0m0.015s sys 0m0.030s xslt1: real…

  • 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