Keywords

Python ↔ Baobab
22 correspondences

Every Python keyword has a direct French equivalent. Same indentation, same semantics: only the language changes.

PythonBaobabDescription
if / elif / elsesi / sinonsi / sinonConditional branching.
for x in …pour x dans …Loop over an iterable.
whiletantqueConditional loop.
deffonctionFunction definition.
returnretournerReturn a value from a function.
classclasseClass definition.
breakcasserExit the loop immediately.
continuecontinuerSkip to the next iteration.
passpasserEmpty statement (does nothing).
try / except / finallyessayer / attraper / enfinException handling.
raiseleverRaise an exception.
with … as …avec … comme …Context manager (files, resources).
import / fromimporter / depuisModule imports.
True / False / Nonevrai / faux / nulBoolean literals and null value.
and / or / notet / ou / nonLogical operators.
in / not indans / non dansMembership test.
isestIdentity test (same object).
delsupprimerDelete a variable or item.
lambdalambdaOne-line anonymous function.
globalglobalDeclare a global variable inside a function.
assertaffirmerCheck a condition is true, otherwise raise an error.
yieldproduireYield a value from a generator.
Complete example — Baobab ↔ Python
Baobab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Panorama des mots-clés pour n dans intervalle(10): si n == 3: continuer # saute 3 sinonsi n == 7: casser # arrête à 7 sinon: afficher(n) # → 0 1 2 4 5 6 essayer: supprimer inconnu attraper Erreur comme e: afficher("Attrapé !") enfin: afficher("Toujours exécuté")
Python
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# Keyword overview for n in range(10): if n == 3: continue # skips 3 elif n == 7: break # stops at 7 else: print(n) # → 0 1 2 4 5 6 try: del inconnu except Exception as e: print("Attrapé !") finally: print("Toujours exécuté")