问题描述
我的公司正在将 Python 用于一个相对简单的嵌入式项目.还有其他人在嵌入式平台上使用 Python 吗?总的来说,它对我们来说效果很好,可以快速开发应用程序,快速调试.我喜欢这种语言的整体简洁".
My company is using Python for a relatively simple embedded project. Is anyone else out there using Python on embedded platforms? Overall it's working well for us, quick to develop apps, quick to debug. I like the overall "conciseness" of the language.
我在日常工作中遇到的唯一真正问题是,与常规编译器相比,缺少静态检查可能会导致在运行时引发问题,例如一个简单的意外 cat 字符串和 print 语句中的 int 可能会导致整个应用程序崩溃.
The only real problem I have in day to day work is that the lack of static checking vs a regular compiler can cause problems to be thrown at run-time, e.g. a simple accidental cat of a string and an int in a print statement can bring the whole application down.
推荐答案
我们在很多地方都使用python 带有 ARM 处理器的嵌入式板卡 和 16 MB 的 RAM(运行 linux).
We use python in quite a lot of embedded boards with ARM processors and 16 MB of RAM (running linux).
它工作得非常好,而且很容易快速编写自定义代码——这是 python 的强项之一.
It works really well and is really easy to make custom code quickly - one of the strong points of python.
至于代码的可靠性 - 我们尝试实现 100% 的测试覆盖率.用 python 编写测试非常快,它会给你一种美妙的自信感.我们使用 twisted trial 来运行测试并报告覆盖率,但还有许多其他工具可用.
As for reliability of the code - we try to have 100% test coverage. Writing tests with python is very quick and it gives you a wonderful feeling of confidence. We use twisted trial to run the tests and report on coverage, but there are many other tools available.
根据我的经验,python + 测试比任何其他替代方案更可靠且编写速度更快.
In my experience python + tests is more reliable and much quicker to write than any other alternatives.
嵌入式工作的唯一缺点是有时 python 可能很慢,有时它使用大量内存(相对而言).这还没有给我们带来节目停止问题,如果它成为问题,python 很容易分析速度和内存.
The only downsides for embedded work is that sometimes python can be slow and sometimes it uses a lot of memory (relatively speaking). This hasn't causes us a show stopping problem yet, and python is quite easy to profile for both speed and memory if it becomes a problem.
pychecker 也是一个非常有用的工具,它可以捕获很多常见错误.
pychecker is a very useful too also which will catch quite a lot of common errors.
这篇关于有人使用 Python 进行嵌入式项目吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!