4 Matching Annotations
  1. Feb 2025
    1. Generator expressions follows almost the same syntax as list comprehensions but return a generator instead of a list. Creating a new list requires more work and uses more memory. If you are just going to loop through the new list, prefer using an iterator instead.

      Utiliser un générateur quand on veut parcourir des éléments et faire un max, etc.

    2. Even though both functions look identical, because lookup_set is utilizing the fact that sets in Python are hashtables, the lookup performance between the two is very different

      Utiliser des sets et dictionnaires dès qu'on peut

    3. However, when a function has multiple main exit points for its normal course, it becomes difficult to debug the returned result, so it may be preferable to keep a single exit point.

      Avoir un seul retour c'est mieux

    4. Using this convention generously is encouraged: any method or property that is not intended to be used by client code should be prefixed with an underscore. This will guarantee a better separation of duties and easier modification of existing code; it will always be possible to publicize a private property, but making a public property private might be a much harder operation.

      Tout doit être privé par défaut + en python on utilise les convetions pour définir privé et le code client est responsable de les respectée