wiki@my.terrot.net

Wiki@my.terrot.net is a service provided by Terrot.Net a company of the Terrot Research & Services Group.

Outils pour utilisateurs

Outils du site


python

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
python [2017/01/03 18:08] francoispython [2019/09/10 16:52] (Version actuelle) francois
Ligne 1: Ligne 1:
-==== Development Environment and librairies ====+====== Development Environment and librairies ====== 
 +===== Eclipse ===== 
 +  * pydev 
 +  * mylin 
 + 
 +===== Modules ===== 
 Please here after the typical list of addition packages I'm using.\\ Please here after the typical list of addition packages I'm using.\\
 Most of same are compliant with **pip** download installation mode:\\ Most of same are compliant with **pip** download installation mode:\\
Ligne 12: Ligne 18:
   * lxml (see below for installation)   * lxml (see below for installation)
   * pywin32 (see below fo installation)   * pywin32 (see below fo installation)
 +  * unidecode (pylib)
  
 === lxml installation instructions === === lxml installation instructions ===
Ligne 64: Ligne 71:
   # python setup3.py -q install   # python setup3.py -q install
  
-==== Fundamental Rules ====+====== Development Rules ======
  
-== RUL_GEN_001 Comments == +===== Fundamental Rules =====
-A comment is there to explain the code not to rephrase it.\\ +
-Comment shall not contradict the code, update the comment with the code.+
  
-== RUL_GEN_002 Important Rule ==+== RUL_GEN_001 Important Rule ==
 <note tip> <note tip>
 If you don't understand why you should not modify a line, **DON'T MODIFY IT!**  If you don't understand why you should not modify a line, **DON'T MODIFY IT!** 
 </note> </note>
-== RUL_GEN_003 More Important Rule ==+ 
 +== RUL_GEN_002 More Important Rule ==
  
 Don't modify a line just to make it nicer, better, what ever justification you want, until there is a declared issue or an enhancement or task assigned to you linked with the line. Don't modify a line just to make it nicer, better, what ever justification you want, until there is a declared issue or an enhancement or task assigned to you linked with the line.
  
-== RUL_GEN_004 Mosy Important Rule ==+== RUL_GEN_004 Most Important Rule ==
 <note warning> <note warning>
 **In any case, Keep it simple**  **In any case, Keep it simple** 
 </note> </note>
  
-===== Coding Rules =====+== RUL_GEN_005 Guru rule== 
 + 
 +Do what I say, Don't do what I do. 
 + 
 +===== Comment Rules ===== 
 + 
 +== RUL_CMT_001 Comments == 
 +A comment is there to explain the code not to rephrase it.\\ 
 +Comment shall not contradict the code, update the comment with the code. 
 + 
 +== RUL_CMT_002 Doc Strings == 
 +Always use DocStrings for Files, Class and functions comment block.\\ 
 + 
 +== RUL_CMT_004 DocString is for users == 
 +DocString section is for user of the element not for developper/maintainer. It shall explain how to use the class/function, not how it has been developped. 
 + 
 +== RUL_CMT_003 Maintainer comments == 
 +Use standard comment immediatly of SocString section for developper/maintainer comments explaining design trick of a class/function. 
 + 
 +===== Coding Rules =====  
 +== RUL_COD_001 : Python version == 
 +Python 3.7 is the preferred Python version. If Python2 is required use Python 2.7.<latest>\\ 
  
-== RUL_COD_001 == +== RUL_COD_002 == 
 Follow the Python development guidelines described in [[https://www.python.org/dev/peps/pep-0008/|PEP008]] with the following adaptations Follow the Python development guidelines described in [[https://www.python.org/dev/peps/pep-0008/|PEP008]] with the following adaptations
  
-==== Edition Rule ====+== RUL_COD_003 == 
 +Use Pylint to check to compliance of your code **AND FIX ALL WARNINGS**.\\ Justification is required when you disable a checker.
  
-== ADV_GEN_005 Tab is not space== 
-Configure your editor to replace tab by 4 spaces (4). If your editor is not enable to replace don't insert TAB. 
  
-== RUL_GEN_006 Indentation == 
-Always use 4 space indentation except for arguments indentation 
  
 +==== Edition Rule ==== 
 +
 +== RUL_WRI_001 Tab is not space==
 +Configure your editor to replace TAB character by **4 spaces**. If your editor is not enable to replace automatically, don't use TAB or better change your editor to another one.
 +
 +== RUL_WRI_002 : UTF-8 (deprecated as default in Python3) ==
 +Make sure your environment is configured to use only 'UTF-8'.
 +  # -- coding:UTF-8 --
 +
 +== RUL_WRI_003 : Activate future features (Python2 only) ==
 +
 +Make your Python2 code compliant with Python3 by inserting at least : (from [[https://linuxfr.org/news/python-pour-la-rentree-2019-partie-2-48277b5e-c1a0-441e-836a-5c9536c4a8d6|Python pour la rentrée 2019 — partie 2]])
 +
 +  from __future__ import absolute_import
 +  from __future__ import division
 +  from __future__ import print_function
 +  from __future__ import unicode_literals
 +  
 +  from builtins import *
 +  
 +  from future import standard_library
 +  standard_library.install_aliases()
 +
 +  
 +== RUL_WRI_004 Indentation ==
 +Always use **4 spaces** indentation except for function arguments indentation.(see PEP008)
 +
 +==== Strings ====
 +
 +== RUL_STR_01 bytes storage (was: str usage) ==
 +Python2: Use ''str'' only for internal 7 bits characters string or ''bytes'' storage\\
 +Python3: Use only ''bytes'' for bytes storage.
  
-=== Strings === 
-== RUL_STR_01 str usage == 
- Use ''str'' only for internal 7 bits characters string or ''bytes'' storage 
 == RUL_STR_002 QString usage == == RUL_STR_002 QString usage ==
 +
 Use ''QString'' only for Qt API functions and methods, convert results as soon as possible to ''unicode'' to be compliant for Python functions. Use ''QString'' only for Qt API functions and methods, convert results as soon as possible to ''unicode'' to be compliant for Python functions.
 +
 == RUL_STR_003 Use unicode == == RUL_STR_003 Use unicode ==
 +
 For all other strings use ''unicode'' only strings. For all other strings use ''unicode'' only strings.
  
 === Classes === === Classes ===
  
 +== RUL_CLS_001 Forget old-style class ==
 +
 +Python 2: Any class MUST inherit directly or indirectly from ``object``.
 +
 +== RUL_CLS_002 ==
 +
 +Use ``self`` to identify instance parameter and ``cls`` for class  related parameter.
 +
 +== RUL_CLS_003 ==
 +
 + 
  
python.1483463332.txt.gz · Dernière modification : 2017/01/03 18:08 de francois

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki