mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
Update for 'with' statement.
This commit is contained in:
parent
a9f068726f
commit
20e192b6a6
3 changed files with 24 additions and 17 deletions
|
|
@ -13,20 +13,28 @@ repository.
|
|||
# OPTIONAL: XXX catch your attention
|
||||
|
||||
# Statements
|
||||
from __future__ import with_statement # Import
|
||||
from sys import path as thing
|
||||
assert True # keyword
|
||||
def foo(): # function definition
|
||||
return []
|
||||
class Bar(object): # Class definition
|
||||
pass
|
||||
def __context__(self):
|
||||
return self
|
||||
def __enter__(self):
|
||||
pass
|
||||
def __exit__(self, *args):
|
||||
pass
|
||||
foo() # UNCOLOURED: function call
|
||||
while False: # 'while'
|
||||
continue
|
||||
for x in foo(): # 'for'
|
||||
break
|
||||
with Bar() as stuff:
|
||||
pass
|
||||
if False: pass # 'if'
|
||||
elif False: pass
|
||||
else False: pass
|
||||
from sys import path as thing # Import
|
||||
else: pass
|
||||
|
||||
# Constants
|
||||
'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue