Python – String interning

Python - Notes (Menu principal) Toutes les chaines de caractères sont stockées à des adresses mémoires différentes, sauf si elles s'apparentent à une variable : minuscules, underscores et chiffres. a…

Continuer la lecture Python – String interning

Python – Object Mutability

Python - Notes (Menu principal) my_list = [1, 2, 3] print(my_list) print(hex(id(my_list))) [1, 2, 3] 0x5e020c8 my_list.append(4) print(my_list) print(hex(id(my_list))) [1, 2, 3, 4] 0x5e020c8 my_list_1 = [1, 2, 3] print(my_list_1)…

Continuer la lecture Python – Object Mutability

Python – repr VS str

Python - Notes (Menu principal) class Rectangle: def __init__(self, width, height): self.width = width self.height = height def area(self): return self.width * self.height def perimeter(self): return 2 * (self.width +…

Continuer la lecture Python – repr VS str

Python – Notes

Python - Multi-line Statements Python - Ternary Operator Python - Type Annotations Python - Try Except Finally Python - repr VS str Python - Object Mutability Python - String Interning

Continuer la lecture Python – Notes