On Monday, July 4, 2016 at 12:02:41 AM UTC+8, Steven D'Aprano wrote:
> I have some code which can preprocess (using a metaclass) or postprocess
> (using a decorator) a class:
>
> @process
> class K:
> pass
>
>
> class K(metaclass=process):
> pass
>
>
> Both should give the same result,
On Sun, Jul 3, 2016 at 4:02 PM, Steven D'Aprano wrote:
> Is there any documentation for exactly what keys are added to classes when?
It should be documented that the namespace that's passed to the
metaclass contains __module__ and __qualname__, and optionally __doc__
if the class has a docstring.
On Sun, Jul 3, 2016 at 10:02 AM, Steven D'Aprano wrote:
> If I then try it against two identical (apart from their names) classes, I
> get these results:
>
>
> py> @process
> ... class K:
> ... x = 1
> ...
> ['__dict__', '__doc__', '__module__', '__weakref__', 'x']
> py> class Q(metaclass=proc
I have some code which can preprocess (using a metaclass) or postprocess
(using a decorator) a class:
@process
class K:
pass
class K(metaclass=process):
pass
Both should give the same result, but I have found that the results are
slightly different because the dict passed to process as