On 11/12/22 14:57, Cameron Simpson wrote:
You shouldn't need a throwaway class, just use the name "classmethod"
directly - it's the type!
if not callable(factory):
if type(factory) is classmethod:
# replace fctory with a function calling factory.__func__
factory = lambda arg: factory.__func__(classmethod, arg)
else:
raise TypeError("unhandled factory type %s:%r" %
(type(factory), factory)
value = factory(d[attr])
Or I could use the C++ version:
face << palm;
Thanks!
--
========================================================================
Google Where SkyNet meets Idiocracy
========================================================================
--
https://mail.python.org/mailman/listinfo/python-list