[hemmerling] Python 4/10 - Pro & Contra

Pro Python

The Zen of Python

  1. Python.org "PEP 20 -- The Zen of Python", Stackoverflow "The Zen of Python, by Tim Peters" - “Can I have an example of each of those items, applied to real Python programming?”.
    • Beautiful is better than ugly.
    • Explicit is better than implicit.
    • Simple is better than complex.
    • Complex is better than complicated.
    • Flat is better than nested.
    • Sparse is better than dense.
    • Readability counts.
    • Special cases aren't special enough to break the rules.
    • Although practicality beats purity.
    • Errors should never pass silently.
    • Unless explicitly silenced.
    • In the face of ambiguity, refuse the temptation to guess.
    • There should be one– and preferably only one –obvious way to do it.
    • Although that way may not be obvious at first unless you're Dutch.
    • Now is better than never.
    • Although never is often better than *right* now.
    • If the implementation is hard to explain, it's a bad idea.
    • If the implementation is easy to explain, it may be a good idea.
    • Namespaces are one honking great idea – let's do more of those!

Raymond Hettinger's Thesis

How to Write "Pythonic" Code

Pythonic Documentation Tools

Code Documentation

pybabel

reStructuredText ( reST )

Static Code Analysis Tools for Python

Categories

Style
  • The coding rules Python PEP 8 #.
  • The OpenSource “PyLint” #.
    • The OpenSource Python source code analyzer “PyLint” is integrated in the OpenSource IDEs “PyScripter” and “Spyder” :-).
    • If “PyLint” is not included in a Python distribution, it can´t be installed by well-known automatic installation processes. An installation attempt by “easy_install pylint” is aborted due to syntax errors in downloaded Python files and other faults :-(
    • “PyLint” is similar to “pyflakes” but it doesn't work in real time and its results are printed in the IDE Spyder in a separate widget ( instead of being shown inline in the Spyder Editor ).
Static Code Analysis
Cyclomatic Complexity
Analysis of OpenSource Software of Global Software Repositories

Some other Tools

Online Services

Resources

How do I protect Python Code?

    1. Licenses. Contracts. Terms and Conditions. This still works even when people can read the code. Note that some of your Python-based components may require that you pay fees before you sell software using those components. Also, some open-source licenses prohibit you from concealing the source or origins of that component.
    2. Offer significant value. If your stuff is so good – at a price that is hard to refuse – there's no incentive to waste time and money reverse engineering anything. Reverse engineering is expensive. Make your product slightly less expensive.
    3. Offer upgrades and enhancements that make any reverse engineering a bad idea. When the next release breaks their reverse engineering, there's no point. This can be carried to absurd extremes, but you should offer new features that make the next release more valuable than reverse engineering.
    4. Offer customization at rates so attractive that they'd rather pay you do build and support the enhancements.
    5. Offer it as a web service. SaaS involves no downloads to customers.

Contra Python

Python - Contra

  • The higher expense to get the Python application into the World Wide Web, both as public webservice and as private cloud service.
    • There are just a limited number of webhosting offers “with Python”.
    • In general, the few webhosters which offer webhosting offers “with Python”, offer it just with the more expensive “business professional” offers. While some affordable entry offers include Perl, though...
    • If the available webhosting offers don´t fit, you have to rent a more expensive whole server ( a physical computer with CPU, memory, disk space, operating system ), like with Java and .NET applications too. Additionally, it is up to you to manage and administrate the server, e.g. update the operating system with security patches ect.

Script Language - Contra

  • If you distribute code, you can´t distribute “binary code”, but you always have to distribute the full source code.
    • You can´t protect your intellectual properties.
    • The most common commercial business model “granting a licence for using a binary code” is not applicable.
    • The successful Shareware business model “free distribution of a time-limited, but not feature-limited code” ist not applicable.
    • Indeed, the business model “offering a web service” might work, if your potential customers are willing to store ( private ) data in the Cloud - even for testing the service. Anyhow, you have to be complient to ( European ) data privacy law!
    • But you can't offer the successfull business option “If you are a big customer, and just in case that you don´t want to use our service in the Cloud, we may implement our service on a local server in your company network”, without distribution of the full source code.
    • Even if you are used to supply the source code to your customer ( as you work on the base of contracts for work and labor ), this does not mean that your customer is willing to grant its customers access to it...
    • If you are running your own business with a business model suitable for your Python code: You can´t sell the business later to a party with an improper business model...

Python on Embedded Systems - Contra

General Contra

  • Is the concept of the Python application and its Python runtime that of a true realtime application ( making use of internal microcontroller devices like timers ), or similar to the concept of Arduino ( polling of devices with simple-minded code prefered, avoiding interrupt routines as much as possible, and ignoring the usefullness of timer devices on microcontrollers for the generation of “hardware does it, not software” solutions )?

Python on Embedded Systems run by Microcontrollers with Operating System - Contra

  • Does the implementation of the operating system provide special file and character device drivers, so that you can address the internal devices and external peripheral units ( e.g. by microcontroller buses like SPI and I2C ) with some elegance?
  • Can you really make use of internal microcontroller devices ( e.g. timers, dividers, special registers ) and its behaviour ( e.g. setting of the information flow from an electrical signal to an interrupt signal or state of the CPU ) with the same elegance as with native C/C++ code on a microcontroller system without operating system? Same as with other script applications and Java applications... :-(.

Python on Embedded Systems run by Microcontrollers with little RAM ( e.g. 8 KBytes, 16 KBytes, 32 KBytes,..) without Operating System - Contra

Appropriate OpenDirectory Directory Pages

 
en/python04.html.txt · Last modified: 2017/12/11 17:54 (external edit) · []
Recent changes RSS feed Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki