IoT M2M blog

The home of free hints and tips about wireless IoT / M2M

Python in M2M

Programming language Python

Python in M2M

Books about Python

Comparing Python with C++

Python code is typically 3-5 times shorter than equivalent Java code. However it is often 5-10 times shorter than equivalent C++ code. One Python programmer can finish in two months what two C++ programmers can’t complete in a year. Python shines as a glue language, used to combine components written in C++.

Python is an object-oriented, strictly, dynamically typed, lexically scoped programming language. Its object model is quite flexible (single-dispatch, meta-classes, everything is an object), and somewhat similar to Basic and Pascal. The origin Python has some functional programming features: first-class functions, map(), reduce(), list comprehensions, and lexical closures. Inside of the GPRS module is a limited version in use. Anyhow, this limited version is often more than enough to cover the needs in M2M.
Python is a extremely “free-form” language with very few ways of invariant construction. A loop with ” FOR NEXT” can be reduced to “FOR”, because the end of the loop can be forced by shifting the next instruction left.

Comparing Python with Java

Python is expected to run slower than Java, but they also take much less time to develop. In M2M projects often the speed is less important. Most time a M2M devices is waiting for an event. Python code is much times shorter than Java code. This difference can be attributed to Python’s built-in high-level data types and its dynamic typing.

Java code
public class HelloWorld
{
public static void main (String[] args)
{
System.out.println(”Hello, world!”);
}
}

if ( a > b )
{
a = b;
b = c;
}

Python code
print “Hello, world!”

if a > b :
a = b
b = c

Python

Python is an object-oriented, strictly, dynamically typed, lexically scoped programming language
Its object model is quite flexible (single-dispatch, metaclasses, everything is an object), and somewhat similar to that of Smalltalk. Python has some functional programming features: first-class functions, map(), reduce(), list comprehensions, and lexical closures. Python is a very “free-form” language with very few ways of invariant construction.

Comparing Python with Java

Python is expected to run slower than Java, but they also take much less time to develop. Python code is typically 3-5 times shorter than equivalent Java code. This difference can be attributed to Python’s built-in high-level data types and its dynamic typing.

99 bottles of beer

There is a collection programs for the Song 99 Bottles of Beer programmed in different programming languages. The song is represented in much more than 1000 different programming languages and variations.The links to Python, Java and C++ as below. The Python code is much shorter as usual.

Your starting point can be a ready to use Python terminal or just a plain GPRS module with Python engine. The ready to use Python terminal can be customised, the software can be written by you or by third party. Last but not least you can get a own M2M device from scratch. If you have interest in an own Python based M2M application, then just drop an email to harald.naumann (at) gsm-modem.de or use the form to get further details.

Leave a Reply

Your email address will not be published. Required fields are marked *

Blue Captcha Image
Refresh

*

Harald Naumann © 2014 Frontier Theme