Skip to content

Instantly share code, notes, and snippets.

@drj11
Created March 22, 2016 11:18
Show Gist options
  • Save drj11/5661d45da6268d856ea0 to your computer and use it in GitHub Desktop.
Save drj11/5661d45da6268d856ea0 to your computer and use it in GitHub Desktop.
from __future__ import print_function
class S():
_ = print("executing class S")
x = 1
y = x
print("S.y", S.y)
try:
class A(S):
_ = print("executing class A")
y = x
except NameError:
pass
try:
A
except NameError:
print("A is not defined; as expected")
else:
assert not "A is defined"
class B(S):
_ = print("executing class B")
print("B.y", B.y)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment