summaryrefslogtreecommitdiffstats
path: root/Demo/metaclasses/Meta.py
diff options
context:
space:
mode:
Diffstat (limited to 'Demo/metaclasses/Meta.py')
-rw-r--r--Demo/metaclasses/Meta.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/Demo/metaclasses/Meta.py b/Demo/metaclasses/Meta.py
index 9529e0f..90bfd97 100644
--- a/Demo/metaclasses/Meta.py
+++ b/Demo/metaclasses/Meta.py
@@ -31,7 +31,7 @@ class MetaHelper:
try:
ga = self.__formalclass__.__getattr__('__usergetattr__')
except (KeyError, AttributeError):
- raise AttributeError, name
+ raise AttributeError(name)
return ga(self, name)
if type(raw) != types.FunctionType:
return raw
@@ -71,7 +71,7 @@ class MetaClass:
return base.__getattr__(name)
except AttributeError:
pass
- raise AttributeError, name
+ raise AttributeError(name)
def __setattr__(self, name, value):
if not self.__inited:
@@ -96,20 +96,20 @@ Meta = MetaClass('Meta', (), {})
def _test():
class C(Meta):
def __init__(self, *args):
- print "__init__, args =", args
+ print("__init__, args =", args)
def m1(self, x):
- print "m1(x=%r)" % (x,)
- print C
+ print("m1(x=%r)" % (x,))
+ print(C)
x = C()
- print x
+ print(x)
x.m1(12)
class D(C):
def __getattr__(self, name):
- if name[:2] == '__': raise AttributeError, name
+ if name[:2] == '__': raise AttributeError(name)
return "getattr:%s" % name
x = D()
- print x.foo
- print x._foo
+ print(x.foo)
+ print(x._foo)
## print x.__foo
## print x.__foo__