Python tips and tricks
The Good, Bad and the Ugly
توی این کانال فقط قرار هست در مورد core python صحبت کنیم.
این کانال یک بلاگ شخصی هست و پیرامون نظرات و چیزهایی که توی بیش از ۱۰ سال کد زدن یاد گرفتم (فقط برای کمک به دوستان تازهکار)
Admin: @Abbasi_ai
Created
Between 1 November 2022 and 31 July 2023— estimated from Telegram’s id allocation, not measured. How this range is calculated.
4 measurements spanning 6 days, net +36. Dots are measurements; the straight line between them is drawn to join them, not to claim we know the path taken in between — snapshots are recorded only when a count changes, so gaps mean “no change observed”, never “interpolated”. The vertical axis spans 9,854–9,904 and does not start at zero.
Measurement log — every subscribers count we have recorded
Measured (UTC)
Subscribers
Change
12 Aug 2026, 16:04
9,898
+29
10 Aug 2026, 00:02
9,869
+9
7 Aug 2026, 02:17
9,860
-2
6 Aug 2026, 22:01
9,862
first reading
Engagement
22 posts held, back to 13 June 2026 — the reader has not yet reached the start of this channel’s public history, so older posts may sit further back, unread. Read across 16 pagesof Telegram’s post history, 20 posts per page.
ERR · 30 days
30.6%
avg views ÷ 9,898 subscribers
Avg views / post
3,030
9 posts measured
Reaction rate
0.869%
reactions ÷ views · ER floor
Posts in window
9
of 22 held
ERR is average views per post over the last 30 days divided by subscribers, the definition TGStat uses, so this figure is comparable with the one you will see elsewhere. It falls structurally as a channel grows: a high ERR on a small channel and a low one on a large channel describe reach mathematics, not quality. We publish the figure and the sample it came from and pass no verdict on it.
ER is defined industry-wide as (forwards + reactions + comments) ÷ views— note the denominator is views, not subscribers. Telegram’s public web preview carries views and reactions but not forward or comment counts, so the reaction rate above is the reactions term only and is therefore a floor: the true ER for this channel is higher by an amount we have not measured and will not estimate.
What these figures were computed from
Window
Rolling 30 days · latest post in window 9 August 2026
Posts held
22 (13 June 2026 – 9 August 2026)
Views total
27,260
Reactions total
237
Forwards / comments
not exposed by the public surface — not measured, not estimated
Readings taken
13 Aug 2026, 05:35 UTC
Views are a single reading per post, taken at the time above. A post published in the last day or two is still accumulating views, which pulls the 30-day average down slightly. That is a property of the standard definition rather than a fault in it, so we keep the definition rather than “correcting” the number into something nobody can reproduce.
Precision. Telegram publishes view counts on its public widget in short form — 8.12K, 3.7M — so any reading at or above 1,000 reaches us rounded to three significant figures, and only counts below 1,000 are exact. Averages and rates derived from them are shown to the same precision rather than to the unit: a figure like 3,701,250 would assert digits nobody measured.
Reaction counts are published per emoji and rounded the same way, so a total below 1,000 is exact and a larger one is a sum that may carry a rounded component from each emoji above 1,000. Because it is a sum, it does not look rounded — read a large reaction total as three significant figures per contributing emoji rather than as the figure it prints.
What this channel posts
Photos
196
Videos
11
Links
170
Lifetime counters from Telegram’s own channel header, read 13 August 2026 — not the date at the top of this page, which is when the subscriber count was last read. Below Telegram’s rounding threshold, so these counts are exact.
Reaction mix
811 reactions across 21 posts, in 1 kind.
Every reaction kind recorded on the sample, most used first
Reaction
Count
Share
Share, drawn
👍
811
100.0%
No sentiment is inferred, and none should be read in. This table is ordered by count and by nothing else. Emoji do not carry stable meaning across languages or communities — 🙏 is thanks in one channel and mourning in another — so we publish which ones were pressed and how often, and pass no judgement on what an audience meant by them.
Precision. Telegram publishes reaction counts per emoji and short-forms each one — 4.34K, 1.2M — so any single kind at or above 1,000 reaches us at three significant figures, and only counts below 1,000 are exact. The shares above are ratios of those figures and carry the same error. This is also why the total here can differ slightly from a reaction total printed elsewhere on the page: both are sums of the same rounded parts, taken over samples with different edges.
Coverage. Reactions were read on 21 of the 22 sampled posts in this sample. Summed by Telegram’s own count on each post — not by adding up the per-emoji breakdown above — those same posts carry 811reactions in total: the kind of figure the paragraph above means by “a reaction total printed elsewhere on the page”.
Measured over the 22 most recent posts we hold, published 13 June 2026 to 9 August 2026, using the newest reading held for each. Telegram Stars are excluded: they are a payment, not a reaction, and they have their own section.
داشتم داستان ۲ هفته troubleshoot کردنم برای یک شرکت رو مینوشتم و اینکه ۷ نفر قبل من رفته بودند و راهکاری پیدا نشده بود.
حتی بهشون جابجایی استک پایتون رو هم پیشنهاد داده بودند.
و حتی اینکه خرید سرور تا ۳ برابر قویتر هم کمکی نکرده بود.
که سیستمم خاموش شد (نوسان برق)
خلاصهاش رو بگم،
تیبل refresh token رو براش بکگراند جاب بنویسید تمیز کنه.
که اگر یکی refresh token رو اشتباهی گذاشت روی 1 ساعت و ۵ میلیون یوزر داشتید
ت…
یک آپشن روی sqlalchemy برای relationship هست که شخصا خیلی دوسش دارم؛ باعث میشه به کوئری که سمت دیتابیس میفرستم فکر کنم بجای اینکه سادهترین راه رو انتخاب کنم.
هرجا هم که نیاز دارم دولوپرها به کوئریهاشون دقت کنند حتما ازش استفاده میکنم.
lazy = "raise"
الان داشتم خروجی پروفایلینگ یک پروژه رو نگاه میکردم؛ توی RandRng گفتم راجبش.
دیدم خیلی کوئریهای دیتابیس زمان بر هست؛ ی سرچ توی مدلهای دیتابیس زدم و همهی relatio…
این ترکیب به راحتی میتونه خیلی از پروژهها رو از Postgres به Sqlite منتقل کنه؛
Sqlite + Litestream
توی خیلی پروژهها برای خودم پیش اومده که یک دیتابیس نیاز داشتم؛ شاید ۵-۱۰ تا جدول ولی اینکه فقط روی یک سرور نباشه هم برام مهم بوده که خب سرویسهای کلاد رو استفاده میکردم.
همزمان هم Latency میرفت بالا هم کلی هزینه پرفورمنس واسه سربارهایی کار کردن با Postgres میدادم درحالی که به ۹۰٪ اون ویژگیها نیازی نداشتم.
الان د…
اینو یادداشت کرده بودم که بذارم:
تقریبا ۱.۵ سال پیش روی یک پروژهای کار میکردم (فکر کنم گفتم جزو معدود پروژههایی بود که از اول توی پروژه بودم)
امشب با مدیرعامل شرکت و صاحب پروژه صحبت میکردم (شاید پروژه دوم) میگفت علاوه بر دولوپرهای بعدی ادمین دیتابیس هر چندوقت یکبار که روی دیتابیس کار میکنه ی دمش گرم هم به ما میگه.
من استانداردهای زیادی رو رعایت کردم روی اون پروژه ولی این ۵ خط بنظر میاد خیلی بچههایی که رو…
Background jobs
رو توی دو مرحله پیادهسازی کن
مرحله اول رو با خود
Fastapi
پیاده سازی کن ببرش زیر لود تست بعد ببین چه اتفاقی میوفته
ADR-0015
رو نمیدونم چی هست ولی اینکه بدونی تا چه زمانی از خود
Fastapi
میتونی استفاده کنی خیلی مهمه بعدش برو روی Dramatiq
——————
Auth
رو با
Argon2
هم چک کن (خیلی واجب نیست فقط برای اینکه بهش آشنا باشی)
————————
برای متریک
prometheus_client
استاندارد اصلی هست
————————
چندتا چیز دیگه که به…
#Backend_RoadMap
#Sample_Project
زحمت این فایل رو شایان عزیز کشیده (با استفاده درست از AI) و توی گروه گذاشت من چندتا نکته رو اضافه کردم و با اجازهاش گفتم بعنوان نمونه اینجا منتشر کنم
پست بعدی نکاتی هست که من اضافه کردم.
#Quick
from pydantic import SecretStr
لطفا ازین مورد استفاده کنید؛ نشستم لاگ سرور یک پروژه رو میخونم تمام اطلاعات سرور و اطلاعات کاربراش خیلی زیبا و خوانا توی لاگ هست.
قبلا هم یک موردی رو توی
@pyhints
یاد دادم برای لاگ نویسی موارد مهم.
لطفا از هر دو استفاده کنید؛ هیچ چیز مهمی نباید توی لاگ نوشته بشه.
بخصوص ایمیل و شمارهتماس کاربر.
LLM
قراره جای برنامه نویسهارو بگیره ؟
من که کدم رو + دستورالعمل ریفکتور دادم تا برام تمیز کنه و خروجی که توی تصویر هست
نصف باگهای مدلهای LLM رو من درآوردم باید بهم هزینه پرداخت کنند واقعا
پینوشت:
تازه ۳۵ دقیقه هم طول کشید. خودم میزدم ۲۰ دقیقهای تموم میشد.
گزارش تیم مهندسی یکی دیگه از شرکتها برای سالی بین ۲۰۲۳-۲۰۲۵ توی اون رنج بود که شرکت خیلی خیلی بزرگی هم هست و تعداد درخواستهاش تازه به ۵۰۰۰ رسیده
توی دوران جنگ اخیر توی گروه گذاشتم ولی متاسفانه الان پیداش نکردم؛ حتما اگر پیدا کردم اون مورد رو هم اضافه میکنم.
ولی بنظرم همین مورد Stackoverflow هم مورد به اندازه ملموسی هست برای درک این موضوع.
خلاصه مشکل سواد و معماری هست؛ نه فریمورک و زبان برنامهنویسی
👍46
Showing the 12 most recent of 22 posts we hold for @pyHints. View and reaction counts are the latest single reading for each post, not a live figure, and a recent post is still accumulating both. A view count marked ≈ was rounded by Telegram before we ever saw it — t.me prints views in full below 1,000 and to three significant figures above, so ≈1,200,000 means somewhere between 1,150,000 and 1,249,999. Unmarked counts are exact. Text is reproduced from the public post preview and truncated for length.
Citation-graph rank
Citation-graph rank — 637,599 of 1,169,250entries in the measured graph. A weighted position computed from the forward and mention edges below — republished posts weigh more than named mentions — and recomputed periodically, over the whole graph. Published only as this ordinal position, never as a score: a position is a fact, and a score printed beside one channel’s name would read as a verdict this register does not make. The two counts beneath stay separate for the same reason mentions are never summed with forwards anywhere else on this page — a named-by count costs nothing to manufacture. The top 100 by this measure, or how it is computed.
Forward network
Republished by
Channels on the register that have forwarded this channel's posts into their own feed.
Built only from forwarded posts we have actually read, on both sides. Coverage is early and deliberately incomplete: a missing link means we have not read the post that would prove it, never that the relationship does not exist. Counts are distinct forwarded posts observed, so they only ever go up as we read more.
Mentions
Named by 1 registered channel — every channel on the register whose own posts have named this one, by its current username or any other username it currently holds, merged from two separately captured readings of the same fact so a namer caught by only one of them is not missed and a namer both caught is not counted twice. A username this channel has since dropped is not matched — that handle may belong to someone else now, and crediting today’s namer to yesterday’s owner would misattribute it.
Named by
Channels on the register whose posts name this channel's handle.
A mention is a weaker signal than a forward and is counted separately for that reason — naming a channel is not republishing it, and a handle in a post body is easy to place deliberately. The post counts beside each row below are distinct posts in which the handle appeared, from posts we have read on both sides — the “Named by N registered channels” figure above is a different count, of distinct NAMING CHANNELS rather than posts, and is not the sum of the rows under it.
Cite this entry
A live page changes as we take new readings, so a citation should name the measurement it is based on, not just the URL. The line below cites the subscriber count as measured 12 August 2026 — this
entry's latest reading, not the date you are reading this.
“Python Hints” (@pyHints), 9,898 subscribers as measured 12 August 2026. Telegram Register, tgregister.com/channel/pyHints.
Full measurement history, CC BY 4.0. Every reading this register holds for this entry, not just the latest one, as a dated, downloadable record: CSV · JSON. Free to use with attribution to tgregister.com. Each file carries its own generation timestamp, which is the figure to cite for exactly when the data was retrieved.