Salome HOME
ajout Doc
[tools/eficas.git] / Doc / python_rules.rst
1 .. _python-label:
2
3 ===============================
4 rules for python syntax
5 ===============================
6
7 Variable names and identifiers are similar to those in many other languages :
8 ----------------------------------------------------------------------------
9
10 * They start with a letter (A_Z or a-z) or underscore "_"".
11 * They are followed by letters, numbers or underscores.
12 * They are case-sensitive.
13 * A string is a sequence of caracters enclosed by a matching pair of single or double quotes.
14
15 Eficas does not allow you to use uncorrect names :
16
17 .. image:: images/NomPython.png
18
19 Some identifiers are reserved words :
20 -------------------------------------
21
22 * You can't use words of the python language as identifiers.
23 * Eficas itself uses identifiers which become reserved words. For example, you can't use the following words, even if it would make some interesting names:
24         - BLOC, EXCLUS, OPER, ASSD,
25         - EVAL, FACT, FORM, JDC,
26         - REGLE, VALIDATOR, 
27         - ETAPE, ENTITE
28
29 Python's way for  assigning values to variables: 
30 -------------------------------------------------
31
32 * Keep in mind that ".comm" are python files. The simplest form of assignement is : variable = value
33 * The hash character (#) starts a comment
34 * Tuples are enclosed in parentheses. 
35 * Lists are enclosed in bracked.
36 * In tuples or lists, a ',' follows each item especially the last one.
37
38 .. image:: images/ListeEtTuple.png
39