Hearted Youtube comments on Indently (@Indently) channel.

  1. 1900
  2. 1000
  3. 658
  4. 625
  5. 363
  6. 335
  7. 323
  8. 295
  9. 237
  10. 223
  11. 206
  12. 187
  13. 178
  14. You went to a very dangerous territory here... Using pickle to store state of objects in long term has a lot more caveats than just "don't load random stuff from the internet'. 1. Pickle is Python only format. You can't read it from anything else or look at stored data. Even within python there are several versions of pickle and you can't load files stored in newest pickle format on older versions of python. (Last change happened at python 3.8) 2. More importantly, pickle depends deeply on the structure of your code, modules and classes. You can only safely unpickle objects that were stored with the same code structure. Programs tends to change over time. Storage formats change less often and it's easier to consider what to do with old data. Add new attribute to your class or rename one. If you attempt to load pickle file stored in previous version, an object will be restored with attributes as they were in a previous version and they probably won't match the changes you made. Rename the class or put it into different module — and loading will fail. 3. There is a reason why saving into json takes a lot of repeating code: you actually need to say explicitly, what are you planning to store and what name should be attached to it. Your classes could contain some data that is deduced on the fly and there is no use in storing and loading them. And without additional code pickle would just store everything from object (well, technically not everything, there are some exceptions by default). You could specify what to pickle and what not to pickle, but then we return to the same state as before which is — we need to be explicit about what to store and how. 4. There are proper ways to stay with normal interchangeable formats and not writing too much boilerplate. Projects like pydantic, dataclass-json, dataclass_wizard, dataclass_factory and others allows you to specify mapping between most of formats (like json, yaml, or some dictionary loaded from sql database) and your classes. 5. Main purpose of pickle remains to be short term storage of objects so they could be transferred between parts of the system that you maintain, for example, for interprocess communication or sending tasks to worker farm run by celery. And pickle was never intended for long term storage of the system state like you are implying. To summarise: don't use pickle this way if that's not a one-time task and you are planning to use what you have written two month later, there are better solutions.
    177
  15. 175
  16. 171
  17. 153
  18. 153
  19. 141
  20. 131
  21. 130
  22. 127
  23. 114
  24. 114
  25. 113
  26. 103
  27. 103
  28. 101
  29. 98
  30. 90
  31. 90
  32. 90
  33. 90
  34. 85
  35. 84
  36. 82
  37. 81
  38. 78
  39. 78
  40. 72
  41. 69
  42. 67
  43. 67
  44. 67
  45. 64
  46. 63
  47. 59
  48. 58
  49. 57
  50. 56