File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -1264,6 +1264,9 @@ Using the non-data descriptor protocol, a pure Python version of
12641264 def __get__(self, obj, objtype=None):
12651265 return self.f
12661266
1267+ def __call__(self, *args, **kwds):
1268+ return self.f(*args, **kwds)
1269+
12671270.. testcode ::
12681271 :hide:
12691272
@@ -1272,13 +1275,17 @@ Using the non-data descriptor protocol, a pure Python version of
12721275 def f(x):
12731276 return x * 10
12741277
1278+ wrapped_ord = StaticMethod(ord)
1279+
12751280.. doctest ::
12761281 :hide:
12771282
12781283 >>> E_sim.f(3 )
12791284 30
12801285 >>> E_sim().f(3 )
12811286 30
1287+ >>> wrapped_ord(' A' )
1288+ 65
12821289
12831290
12841291Class methods
@@ -1344,7 +1351,7 @@ Using the non-data descriptor protocol, a pure Python version of
13441351 if cls is None:
13451352 cls = type(obj)
13461353 if hasattr(type(self.f), '__get__'):
1347- return self.f.__get__(cls)
1354+ return self.f.__get__(cls, cls )
13481355 return MethodType(self.f, cls)
13491356
13501357.. testcode ::
You can’t perform that action at this time.
0 commit comments