{"id":2893,"date":"2011-08-18T13:25:38","date_gmt":"2011-08-18T11:25:38","guid":{"rendered":"http:\/\/www.gsm-modem.de\/M2M\/?p=2893"},"modified":"2011-08-19T14:32:21","modified_gmt":"2011-08-19T12:32:21","slug":"python-in-m2m","status":"publish","type":"post","link":"http:\/\/www.gsm-modem.de\/M2M\/m2m-faq\/python-in-m2m\/","title":{"rendered":"Python in M2M"},"content":{"rendered":"<h2>Programming language Python<\/h2>\n<div id=\"attachment_2894\" style=\"width: 241px\" class=\"wp-caption alignleft\"><a rel=\"attachment wp-att-2894\" href=\"http:\/\/www.gsm-modem.de\/M2M\/?attachment_id=2894\"><img aria-describedby=\"caption-attachment-2894\" decoding=\"async\" loading=\"lazy\" class=\"size-medium wp-image-2894\" title=\"Python-language\" src=\"http:\/\/www.gsm-modem.de\/M2M\/.\/wp-content\/uploads\/2011\/08\/Python-language-231x300.jpg\" alt=\"Python in M2M\" width=\"231\" height=\"300\" \/><\/a><p id=\"caption-attachment-2894\" class=\"wp-caption-text\">Books about Python<\/p><\/div>\n<h3>Comparing Python with C++<\/h3>\n<p>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\u00e2\u20ac\u2122t complete in a year. Python shines as a glue language, used to combine components written in C++.<\/p>\n<p>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.<br \/>\nPython is a extremely \u00e2\u20ac\u0153free-form\u00e2\u20ac\u009d language with very few ways of invariant construction. A loop with &#8221; FOR NEXT&#8221; can be reduced to &#8220;FOR&#8221;, because the end of the loop can be forced by shifting the next instruction left.<\/p>\n<h3>Comparing Python with Java<\/h3>\n<p>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\u00e2\u20ac\u2122s built-in high-level data types and its dynamic typing.<\/p>\n<table style=\"height: 252px;\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\" width=\"572\">\n<colgroup>\n<col width=\"263\"><\/col>\n<col width=\"309\"><\/col>\n<\/colgroup>\n<tbody>\n<tr height=\"269\">\n<td class=\"xl63\" style=\"height: 201.6pt; width: 197pt;\" width=\"263\" height=\"269\"><strong>Java   code<\/strong><br \/>\npublic class HelloWorld<br \/>\n{<br \/>\npublic static void main (String[] args)<br \/>\n{<br \/>\nSystem.out.println(\u00e2\u20ac\u009dHello, world!\u00e2\u20ac\u009d);<br \/>\n}<br \/>\n}<\/p>\n<p>if ( a &gt; b )<br \/>\n{<br \/>\na = b;<br \/>\nb = c;<br \/>\n}<\/td>\n<td class=\"xl63\" style=\"width: 232pt;\" width=\"309\"><strong>Python code<\/strong><br \/>\nprint \u00e2\u20ac\u0153Hello, world!\u00e2\u20ac\u009d<\/p>\n<p>if<span> <\/span>a &gt; b :<br \/>\na = b<br \/>\nb = c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<div id=\"_mcePaste\" style=\"position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;\">\n<h1>Python<\/h1>\n<p>Python is an object-oriented, strictly, dynamically typed, lexically scoped programming language<br \/>\n<img decoding=\"async\" loading=\"lazy\" id=\"Bild2\" src=\"..\/..\/image\/Python-language.jpg\" border=\"0\" alt=\"\" hspace=\"3\" vspace=\"0\" width=\"207\" height=\"229\" align=\"left\" \/>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  &#8220;free-form&#8221; language with very few ways of invariant construction.<\/p>\n<h2>Comparing Python with Java<\/h2>\n<p>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&#8217;s built-in high-level  data types and its dynamic typing.<\/p><\/div>\n<h3>99 bottles of beer<\/h3>\n<p>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.<\/p>\n<ul>\n<li>Python versions: <a href=\"http:\/\/99-bottles-of-beer.net\/language-python-808.html\">http:\/\/99-bottles-of-beer.net\/language-python-808.html<\/a><\/li>\n<li>Java versions: <a href=\"http:\/\/99-bottles-of-beer.net\/language-java-3.html\">http:\/\/99-bottles-of-beer.net\/language-java-3.html<\/a><\/li>\n<li>C++: <a href=\"http:\/\/99-bottles-of-beer.net\/language-c++-108.html\">http:\/\/99-bottles-of-beer.net\/language-c++-108.html<\/a><\/li>\n<\/ul>\n<p>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 <span style=\"color: #0000ff;\"><strong>harald.naumann (at) gsm-modem.de<\/strong><\/span> or <strong><span style=\"color: #0000ff;\"><a href=\"..\/..\/contact-me\/\"><span style=\"text-decoration: underline;\">use the form<\/span><\/a> <\/span><\/strong>to get further details.<\/p>\n<div class=\"shariff shariff-align-flex-start shariff-widget-align-flex-start\"><ul class=\"shariff-buttons theme-default orientation-horizontal buttonsize-small\"><li class=\"shariff-button twitter shariff-nocustomcolor\" style=\"background-color:#32bbf5\"><a href=\"https:\/\/twitter.com\/share?url=http%3A%2F%2Fwww.gsm-modem.de%2FM2M%2Fm2m-faq%2Fpython-in-m2m%2F&text=Python%20in%20M2M\" title=\"Share on Twitter\" aria-label=\"Share on Twitter\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#55acee; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 30 32\"><path fill=\"#55acee\" d=\"M29.7 6.8q-1.2 1.8-3 3.1 0 0.3 0 0.8 0 2.5-0.7 4.9t-2.2 4.7-3.5 4-4.9 2.8-6.1 1q-5.1 0-9.3-2.7 0.6 0.1 1.5 0.1 4.3 0 7.6-2.6-2-0.1-3.5-1.2t-2.2-3q0.6 0.1 1.1 0.1 0.8 0 1.6-0.2-2.1-0.4-3.5-2.1t-1.4-3.9v-0.1q1.3 0.7 2.8 0.8-1.2-0.8-2-2.2t-0.7-2.9q0-1.7 0.8-3.1 2.3 2.8 5.5 4.5t7 1.9q-0.2-0.7-0.2-1.4 0-2.5 1.8-4.3t4.3-1.8q2.7 0 4.5 1.9 2.1-0.4 3.9-1.5-0.7 2.2-2.7 3.4 1.8-0.2 3.5-0.9z\"\/><\/svg><\/span><span class=\"shariff-text\">tweet<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button facebook shariff-nocustomcolor\" style=\"background-color:#4273c8\"><a href=\"https:\/\/www.facebook.com\/sharer\/sharer.php?u=http%3A%2F%2Fwww.gsm-modem.de%2FM2M%2Fm2m-faq%2Fpython-in-m2m%2F\" title=\"Share on Facebook\" aria-label=\"Share on Facebook\" role=\"button\" rel=\"nofollow\" class=\"shariff-link\" style=\"; background-color:#3b5998; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 18 32\"><path fill=\"#3b5998\" d=\"M17.1 0.2v4.7h-2.8q-1.5 0-2.1 0.6t-0.5 1.9v3.4h5.2l-0.7 5.3h-4.5v13.6h-5.5v-13.6h-4.5v-5.3h4.5v-3.9q0-3.3 1.9-5.2t5-1.8q2.6 0 4.1 0.2z\"\/><\/svg><\/span><span class=\"shariff-text\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button linkedin shariff-nocustomcolor\" style=\"background-color:#1488bf\"><a href=\"https:\/\/www.linkedin.com\/sharing\/share-offsite\/?url=http%3A%2F%2Fwww.gsm-modem.de%2FM2M%2Fm2m-faq%2Fpython-in-m2m%2F\" title=\"Share on LinkedIn\" aria-label=\"Share on LinkedIn\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#0077b5; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 27 32\"><path fill=\"#0077b5\" d=\"M6.2 11.2v17.7h-5.9v-17.7h5.9zM6.6 5.7q0 1.3-0.9 2.2t-2.4 0.9h0q-1.5 0-2.4-0.9t-0.9-2.2 0.9-2.2 2.4-0.9 2.4 0.9 0.9 2.2zM27.4 18.7v10.1h-5.9v-9.5q0-1.9-0.7-2.9t-2.3-1.1q-1.1 0-1.9 0.6t-1.2 1.5q-0.2 0.5-0.2 1.4v9.9h-5.9q0-7.1 0-11.6t0-5.3l0-0.9h5.9v2.6h0q0.4-0.6 0.7-1t1-0.9 1.6-0.8 2-0.3q3 0 4.9 2t1.9 6z\"\/><\/svg><\/span><span class=\"shariff-text\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button mailto shariff-nocustomcolor\" style=\"background-color:#a8a8a8\"><a href=\"mailto:?body=http%3A%2F%2Fwww.gsm-modem.de%2FM2M%2Fm2m-faq%2Fpython-in-m2m%2F&subject=Python%20in%20M2M\" title=\"Send by email\" aria-label=\"Send by email\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#999; color:#fff\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#999\" d=\"M32 12.7v14.2q0 1.2-0.8 2t-2 0.9h-26.3q-1.2 0-2-0.9t-0.8-2v-14.2q0.8 0.9 1.8 1.6 6.5 4.4 8.9 6.1 1 0.8 1.6 1.2t1.7 0.9 2 0.4h0.1q0.9 0 2-0.4t1.7-0.9 1.6-1.2q3-2.2 8.9-6.1 1-0.7 1.8-1.6zM32 7.4q0 1.4-0.9 2.7t-2.2 2.2q-6.7 4.7-8.4 5.8-0.2 0.1-0.7 0.5t-1 0.7-0.9 0.6-1.1 0.5-0.9 0.2h-0.1q-0.4 0-0.9-0.2t-1.1-0.5-0.9-0.6-1-0.7-0.7-0.5q-1.6-1.1-4.7-3.2t-3.6-2.6q-1.1-0.7-2.1-2t-1-2.5q0-1.4 0.7-2.3t2.1-0.9h26.3q1.2 0 2 0.8t0.9 2z\"\/><\/svg><\/span><span class=\"shariff-text\">email<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button whatsapp shariff-nocustomcolor\" style=\"background-color:#5cbe4a\"><a href=\"https:\/\/api.whatsapp.com\/send?text=http%3A%2F%2Fwww.gsm-modem.de%2FM2M%2Fm2m-faq%2Fpython-in-m2m%2F%20Python%20in%20M2M\" title=\"Share on Whatsapp\" aria-label=\"Share on Whatsapp\" role=\"button\" rel=\"noopener nofollow\" class=\"shariff-link\" style=\"; background-color:#34af23; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#34af23\" d=\"M17.6 17.4q0.2 0 1.7 0.8t1.6 0.9q0 0.1 0 0.3 0 0.6-0.3 1.4-0.3 0.7-1.3 1.2t-1.8 0.5q-1 0-3.4-1.1-1.7-0.8-3-2.1t-2.6-3.3q-1.3-1.9-1.3-3.5v-0.1q0.1-1.6 1.3-2.8 0.4-0.4 0.9-0.4 0.1 0 0.3 0t0.3 0q0.3 0 0.5 0.1t0.3 0.5q0.1 0.4 0.6 1.6t0.4 1.3q0 0.4-0.6 1t-0.6 0.8q0 0.1 0.1 0.3 0.6 1.3 1.8 2.4 1 0.9 2.7 1.8 0.2 0.1 0.4 0.1 0.3 0 1-0.9t0.9-0.9zM14 26.9q2.3 0 4.3-0.9t3.6-2.4 2.4-3.6 0.9-4.3-0.9-4.3-2.4-3.6-3.6-2.4-4.3-0.9-4.3 0.9-3.6 2.4-2.4 3.6-0.9 4.3q0 3.6 2.1 6.6l-1.4 4.2 4.3-1.4q2.8 1.9 6.2 1.9zM14 2.2q2.7 0 5.2 1.1t4.3 2.9 2.9 4.3 1.1 5.2-1.1 5.2-2.9 4.3-4.3 2.9-5.2 1.1q-3.5 0-6.5-1.7l-7.4 2.4 2.4-7.2q-1.9-3.2-1.9-6.9 0-2.7 1.1-5.2t2.9-4.3 4.3-2.9 5.2-1.1z\"\/><\/svg><\/span><span class=\"shariff-text\">share<\/span>&nbsp;<\/a><\/li><li class=\"shariff-button rss shariff-nocustomcolor\" style=\"background-color:#ff8c00\"><a href=\"http:\/\/www.gsm-modem.de\/M2M\/feed\/rss\/\" title=\"RSS feed\" aria-label=\"RSS feed\" role=\"button\" class=\"shariff-link\" style=\"; background-color:#fe9312; color:#fff\" target=\"_blank\"><span class=\"shariff-icon\" style=\"\"><svg width=\"32px\" height=\"20px\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 32 32\"><path fill=\"#fe9312\" d=\"M4.3 23.5c-2.3 0-4.3 1.9-4.3 4.3 0 2.3 1.9 4.2 4.3 4.2 2.4 0 4.3-1.9 4.3-4.2 0-2.3-1.9-4.3-4.3-4.3zM0 10.9v6.1c4 0 7.7 1.6 10.6 4.4 2.8 2.8 4.4 6.6 4.4 10.6h6.2c0-11.7-9.5-21.1-21.1-21.1zM0 0v6.1c14.2 0 25.8 11.6 25.8 25.9h6.2c0-17.6-14.4-32-32-32z\"\/><\/svg><\/span><span class=\"shariff-text\">RSS feed<\/span>&nbsp;<\/a><\/li><\/ul><\/div>","protected":false},"excerpt":{"rendered":"<p>Programming language 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\u00e2\u20ac\u2122t complete in a year. Python shines as a glue language, used to combine [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"footnotes":""},"categories":[3],"tags":[50,13,17],"aioseo_notices":[],"_links":{"self":[{"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/posts\/2893"}],"collection":[{"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/comments?post=2893"}],"version-history":[{"count":13,"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/posts\/2893\/revisions"}],"predecessor-version":[{"id":2906,"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/posts\/2893\/revisions\/2906"}],"wp:attachment":[{"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/media?parent=2893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/categories?post=2893"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.gsm-modem.de\/M2M\/wp-json\/wp\/v2\/tags?post=2893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}