Clarify why we don't do hasattr(var, '__exit__).
This commit is contained in:
parent
28e33e4c96
commit
c86e93c058
|
@ -68,8 +68,9 @@ Basic Syntax and Semantics
|
||||||
finally:
|
finally:
|
||||||
var.__exit__()
|
var.__exit__()
|
||||||
|
|
||||||
Note that this makes using an object that does not have an
|
(The presence of an __exit__ method is *not* checked like that of
|
||||||
__exit__() method a fail-fast error.
|
__enter__ to ensure that using inappropriate objects in with:
|
||||||
|
statements gives an error).
|
||||||
|
|
||||||
If the variable is omitted, an unnamed object is allocated on the
|
If the variable is omitted, an unnamed object is allocated on the
|
||||||
stack. In that case, the suite has no access to the unnamed object.
|
stack. In that case, the suite has no access to the unnamed object.
|
||||||
|
|
Loading…
Reference in New Issue