简体   繁体   English

IronPython 是否支持元类?

[英]Does IronPython support metaclasses?

Are Python metaclasses, and class factories fully supported by IronPython? IronPython 是否完全支持 Python 元类和类工厂? If I have a functional code (in CPython 2.7) full with these thing will just work in IronPython?如果我有一个充满这些东西的功能代码(在 CPython 2.7 中)是否只能在 IronPython 中工作?

The best approach is to simply try it.最好的方法是简单地尝试一下。 IronPython and CPython are created differently, and have different optimisations. IronPython 和 CPython 的创建方式不同,并且具有不同的优化。 Basic things like metaclasses should work without problems, but there might be other problems.像元类这样的基本东西应该可以正常工作,但可能还有其他问题。 If you are trying to write code which supports both CPython and IronPython, then you should test it on both platforms as you go.如果您正在尝试编写同时支持 CPython 和 IronPython 的代码,那么您应该随时在两个平台上对其进行测试。 Ie, when you run your test suite, run it in both environments (and any others you intend to support).即,当您运行测试套件时,请在两种环境(以及您打算支持的任何其他环境)中运行它。 I'm not sure if tox supports IronPython, but it might help you set this up.我不确定tox 是否支持 IronPython,但它可能会帮助您进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM