Codesarray

@codesarray

Small games and the code behind them. Short coding lessons with real code and real output.

129 Urmărește14 Urmăritori343 Postări
  1. Codesarray@codesarray
    Postări @codesarray
    Full video, Profiling and performance:
    000
  2. Codesarray@codesarray
    Python timeit.repeat: take the min, not the average. 🐍 repeat(..., repeat=5) -> 133, 108, 193, 155, 141 ms min(runs) -> 108 ms #Python #Coding
    Descarcă
    1001
  3. Codesarray@codesarray
    Postări @codesarray
    Full video, Profiling and performance:
    000
  4. Codesarray@codesarray
    Python profiling and performance, in 4 images. 🐍 timeit compares small pieces of code. cProfile shows where a program spends time: read tottime first. #Python #Coding
    Descarcă
    1001
  5. Codesarray@codesarray
    Postări @codesarray
    Full video:
    0001
  6. Codesarray@codesarray
    Postări @codesarray
    Full video, The import system:
    0003
  7. Codesarray@codesarray
    Python lazy import (3.15): the module loads on first use. 🐍 lazy import json "json" in sys.modules -> False json.dumps([1, 2]) "json" in sys.modules -> True #Python #Coding
    Descarcă
    1002
  8. Codesarray@codesarray
    Postări @codesarray
    Full video, The import system:
    000
  9. Codesarray@codesarray
    Python import system in one idea: import checks sys.modules first, so a module runs once. 🐍 → then sys.path, first match wins → circular import? import the module, use it later → lazy import is coming in 3.15 #Python #Coding
    Descarcă
    100
  10. Codesarray@codesarray
    Postări @codesarray
    Watch it here: Next up: profiling and performance.
    000
  11. Codesarray@codesarray
    Postări @codesarray
    Full video, Descriptors and metaclasses:
    000
  12. Codesarray@codesarray
    Python __slots__: 100,000 objects, 10 MB down to 6. 🐍 class Slim: __slots__ = ("x", "y") No dict per object. #Python #Coding
    Descarcă
    1005
  13. Codesarray@codesarray
    Python @property is a descriptor: a class with __get__ you can write yourself. 🐍 def __get__(self, obj, owner): return self.fget(obj) Runs on every read. #Python #Coding
    Descarcă
    1006
  14. Codesarray@codesarray
    Postări @codesarray
    Full video, Memory model and garbage collection:
    000
  15. Codesarray@codesarray
    Postări @codesarray
    Full video, Descriptors and metaclasses:
    000
  16. Codesarray@codesarray
    Python memory management, in 4 images. 🐍 Reference counting frees most objects at once, and the garbage collector catches the cycles it misses. #Python #Coding
    Descarcă
    1005
  17. Codesarray@codesarray
    Python descriptors, in 4 images. 🐍 An object on the class with __get__ and __set__ runs when you read or assign an attribute. property is built from one. #Python #Coding
    Descarcă
    1001
  18. Codesarray@codesarray
    Postări @codesarray
    Full video:
    000
  19. Codesarray@codesarray
    Postări @codesarray
    Full video:
    0001
  20. Codesarray@codesarray
    Postări @codesarray
    Full video, Threads, processes and free threading:
    000
  21. Codesarray@codesarray
    Postări @codesarray
    Full video, Memory model and garbage collection:
    000