Amo Chen

好文分享 — Automating Python with Google Cloud

如果你想知道怎麼把 Python 程式部署到 GCP(Google Cloud Platform) 的 Serverless 服務的話,可以花點時間閱讀 “Automating Python with Google Cloud” 1 文,該文章將 Google Cloud 所提供的 2 種 Serverless 服

Posted on  Apr 7, 2024  by  Amo Chen  ‐ 1 min read

談 Python 3.12 泛型(Generics)改善的部分

泛型(Generics)是指在定義函式、類別時,不具體指定傳入、回傳值等的型別,而在使用的時候才明確指定型別的功能,是 TypeScript, Java 等程式語言的常見用

Posted on  Apr 5, 2024  by  Amo Chen  ‐ 1 min read

Python 效能之鬼!你應該學會使用的 deque !

程式的效能並不是天生具備,而是榨出來的,特別是對於 Python 這門程式語言而言,如果想要做到 High Performance 的話,有些魔鬼就藏在細節裡。

舉常見的 list 為例,你知道 list 在執行 pop(0)insert(0, value) 是效率較差的嗎?如果你的應用必須經常呼叫 pop(0)insert(0, value) 的話,建議你換個資料結構吧!使用 deque 將會帶來效率的提升!

本文將帶你認識 Python 的 deque 以及它在何種特定情況下能夠帶來效率的提升!

Posted on  Apr 1, 2024  in  Python 程式設計 - 中階  by  Amo Chen  ‐ 4 min read

好文分享 — Every dunder method in Python

物件導向程式設計一直是 Python 重點之一,大家肯定或多或少接觸過 def __init__(self), __repr__(self), __str__(self) 這些方法。 這些方法被稱為 dunder methods, 其中 dunder 是 “double underscore” 的複

Posted on  Mar 31, 2024  by  Amo Chen  ‐ 1 min read