mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
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
2 changed files with 23 additions and 0 deletions
|
@ -260,6 +260,25 @@ print
|
|||
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…
Add table
Add a link
Reference in a new issue