Cython has moved to github.

cython-devel

view tests/run/print.pyx @ 3049:6c0c2ae56034

implemented 'print >> stream'
author Stefan Behnel <scoder@users.berlios.de>
date Tue Mar 09 09:29:47 2010 +0100 (2 years ago)
parents 82d312a9f1fc
children 401e253547d0
line source
1 def f(a, b):
2 """
3 >>> f(1, 'test')
4 <BLANKLINE>
5 1
6 1 test
7 1 test
8 1 test 42 spam
9 """
10 print
11 print a
12 print a,
13 print b
14 print a, b
15 print a, b,
16 print 42, u"spam"
19 try:
20 from StringIO import StringIO
21 except ImportError:
22 from io import StringIO
24 def s(stream, a, b):
25 """
26 >>> stream = StringIO()
27 >>> s(stream, 1, 'test')
28 >>> print(stream.getvalue())
29 <BLANKLINE>
30 1
31 1 test
32 1 test
33 1 test 42 spam
34 <BLANKLINE>
35 """
36 print >> stream
37 print >> stream, a
38 print >> stream, a,
39 print >> stream, b
40 print >> stream, a, b
41 print >> stream, a, b,
42 print >> stream, 42, u"spam"