mirror of https://github.com/python/cpython.git
PEP 214, Extended print Statement, has been accepted by the BDFL.
Additional test cases for the extended print form.
This commit is contained in:
parent
8c0a242289
commit
efc92eec33
|
@ -19,6 +19,10 @@ print_stmt
|
|||
1 2 3
|
||||
1 2 3
|
||||
1 1 1
|
||||
extended print_stmt
|
||||
1 2 3
|
||||
1 2 3
|
||||
1 1 1
|
||||
del_stmt
|
||||
pass_stmt
|
||||
flow_stmt
|
||||
|
|
|
@ -260,6 +260,25 @@ def d22v(a, b, c=1, d=2, *rest): pass
|
|||
print 0 or 1, 0 or 1,
|
||||
print 0 or 1
|
||||
|
||||
print 'extended print_stmt' # 'print' '>>' test ','
|
||||
import sys
|
||||
print >> sys.stdout, 1, 2, 3
|
||||
print >> sys.stdout, 1, 2, 3,
|
||||
print >> sys.stdout
|
||||
print >> sys.stdout, 0 or 1, 0 or 1,
|
||||
print >> sys.stdout, 0 or 1
|
||||
|
||||
# syntax errors
|
||||
def check_syntax(statement):
|
||||
try:
|
||||
compile(statement, '<string>', 'exec')
|
||||
except SyntaxError:
|
||||
pass
|
||||
else:
|
||||
print 'Missing SyntaxError: "%s"' % statement
|
||||
check_syntax('print ,')
|
||||
check_syntax('print >> x,')
|
||||
|
||||
print 'del_stmt' # 'del' exprlist
|
||||
del abc
|
||||
del x, y, (z, xyz)
|
||||
|
|
Loading…
Reference in New Issue