用 Pickle 寫程式是否搞錯了什麼? - splitline
歡迎來到 PyCon TW 2023 共筆
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
共筆入口:https://hackmd.io/@pycontw/2023
手機版請點選上方 按鈕展開議程列表。
Welcome to PyCon TW 2023 Collaborative Writing
Image Not Showing
Possible Reasons
- The image file may be corrupted
- The server hosting the image is unavailable
- The image path is incorrect
- The image format is not supported
Learn More →
Collaborative Writing Workplace:https://hackmd.io/@pycontw/2023
Using mobile please tap to unfold the agenda.
Collaborative writing start from below
從這裡開始共筆
When we use Pickle?
但我們其實不在乎何時用到,因為我們只是想用pickle來寫程式(???)
- Django/Flask caching
- Pre-trained Model
- Inter-Process Communication
Pickora
如何把serial格式變成programming
class SomeClass():
def __reduce__(self):
return (eval, "print('hi')", )
what can pickle opcode do?
- Values: Create string, number, tuple, list, …
- Call function: (without keyword arguments)
- Import something:
from x import y
- Set attribute:
obj.attr = 1337
- Set item:
obj[ ‘key’] = 1337
- Other:
(pickle internal operation)
Function Call
- print("hi")
- c builtins \n print \n
- ( V print \n, V hi \n)
Below is the part that speaker updated the talk/tutorial after speech
講者於演講後有更新或勘誤投影片的部份