2025-06-23_rule-6-always-define-literals.html
001|
002|
003|
004|
005|
006|
007| StringBundle_English = [
008| 'Hello',
009| 'Goodbye',
010| ]
011| StringBundle_Spanish = [
012| 'Hola',
013| 'Adiós',
014| ]
015| StringBundle_German = [
016| 'Hallo',
017| 'Auf Wiedersehen',
018| ]
019| StringBundle_French = [
020| 'Bonjour',
021| 'Au revoir',
022| ]
023| strHello = 0
024| strGoodbye = 1
025|
026|
027|
028|
029| def hello_and_goodbye (lang=StringBundle_English):
030| stringSet = lang
031|
032| print(stringSet[strHello])
033| print(stringSet[strGoodbye])
034| print()
035|
036| hello_and_goodbye()
037| hello_and_goodbye(StringBundle_Spanish)
038| hello_and_goodbye(StringBundle_German)
039| hello_and_goodbye(StringBundle_French)
040|
041|
042| from math import pi
043|
044| two = complex(2, 0)
045| cpi = complex(pi, 0)
046| pi2 = cpi * two
047|
048|
049|