一起使用 Python 3.1 和 2.5
我目前正在为我的编程课做最后一个项目。我们正在用 Python 3.1 编写它,而我正在做 GUI。我的团队领导希望在 3.1 中完成整个项目,但大多数 pyGame 插件(如 pyConsole)给我带来了兼容性问题。
所以,我的问题是,我可以在 2.5 中编写前端,然后将其连接到 3.1 中编写的引擎吗?感谢您的帮助!
I'm currently working the final project for my programming class. We're writing it in Python 3.1, and I'm doing the GUI. My team's leader wants to do the whole project in 3.1, but most pyGame addons (like pyConsole) are giving me compatibility issues.
So, my question is, can I write my frontend in 2.5 and then hook it up to the engine that's written in 3.1? Thanks for your help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
老实说,这可能带来的麻烦大于其价值。
最好的办法是聚集在一起,列出你们想要使用的插件以及它们是否与 3.1 兼容。然后决定你是否可以在没有不兼容的人的情况下生活。如果你不能,就用 2.5 来做这个项目,否则就用 3.1 并为你不能使用的插件制定一个“B 计划”。
如果您小心的话,当这些插件添加对 3.x 的支持时,您可以在以后相对轻松地从 2 切换到 3。
如果这是一个您计划长期从事的项目(即不仅仅是一个班级项目),我可能会说选择 3 并尝试自己移植一些插件。但对于一个班级的期末项目来说,这可能不值得。
To be honest, that's probably more trouble than it's worth.
Your best bet is to get together and make a list of the addons you guys want to use and whether or not they're compatible with 3.1. Then decide if you can live without the incompatible ones. If you can't, do the project in 2.5, otherwise go with 3.1 and have a "Plan B" for the addons you can't use.
If you're careful you can make switching from 2 to 3 relatively painless later on when those addons add support for 3.x.
If it's a project you plan on working on for a long time (i.e. more than just a class project), I'd probably say go with 3 and try porting some of the addons yourself. But for a class' final project it's probably not worth it.
简短回答 否。
更长的答案。您可以使用 Python 2.5 编写前端,使用 3.0 编写后端,但它们根本无法交互。它们之间需要某种抽象层。做这样的事情你可以在另一边使用任何语言。
抽象层需要将作业拉出并推回某种队列。这只是一个愚蠢的例子,当你继续阅读时可能会变得非常复杂。最后,抽象层可能会变得比您的应用程序更复杂,假设它是一个类的工作。
我会听 Jeremiah 并与教授讨论 Python 2.5 或 3.0 的优点和缺点。如果你在最后的论文中解释一下你选择其中一个的原因,我相信你会得到一些额外的分数,而且他几乎不会因此而惩罚你。
Short Answer NO.
Longer Answer. You can write your frontend with Python 2.5 and the backend with 3.0, but they can't interact at all. You need some sort of abstraction layer between them. Doing something like this you can have any language in the other side.
The abstraction Layer would need to pull jobs work on them and push back to some sort of queue. This is just a silly example and can get really complicated as you go by. In the end the abstraction layer may become even more complicated than you application, assuming it's a work for a class.
I'd listen to Jeremiah and discuss with professor about the goods and bads that you have going with Python 2.5 or 3.0. If you include an explanation of the reasons you choose one over the other in your final papper I'm sure you'll get some extra points and he'll hardly penalyze you for it.