Python 在Hy中指定元类的语法

Python 在Hy中指定元类的语法,python,hy,Python,Hy,Hy中指定元类的语法是什么。我尝试了以下方法: (defclass Metaclass [] ) (defclass Foo [ :meta Metaclass ] ) (defclass Foo [ [:meta Metaclass] ] ) 但是这不起作用您可以使用与Python相同的方法来执行此操作 这是在Python3和最新的Hy主机上,使用repl中的--spy选项来显示Python编译 => (defclass Foo [:metaclass print]) class F

Hy中指定元类的语法是什么。我尝试了以下方法:

(defclass Metaclass [] )

(defclass Foo [ :meta Metaclass ] )
(defclass Foo [ [:meta Metaclass] ] )

但是这不起作用

您可以使用与Python相同的方法来执行此操作

这是在Python3和最新的Hy主机上,使用repl中的
--spy
选项来显示Python编译

=> (defclass Foo [:metaclass print])
class Foo(metaclass=print):
    pass


None

Foo () {'__module__': '__console__', '__qualname__': 'Foo'}
在Python2上

=> (defclass Foo []
...  (setv __metaclass__ print))
class Foo:
    __metaclass__ = print


None

Foo () {'__module__': '__console__', '__metaclass__': <built-in function print>}
=>(defclass Foo[]
…(setv元类打印)
Foo类:
__元类\打印
没有一个
Foo(){uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
如果您需要它为其中一个工作,您可以尝试安装
six
兼容性库