TorhamDev | تورهام 😳 – Telegram
TorhamDev | تورهام 😳
2.84K subscribers
421 photos
49 videos
21 files
591 links
code, linux and anything related.

• YouTube
youtube.com/@techwithtori

• CodeNaline Podcast
@CodeNaline

• Group
@GothamProgrammers

• Github
github.com/TorhamDev

• Email
torhamdev@gmail.com
Download Telegram
Forwarded from torhamdev donate
بابا زحمت نکشید ❤️
بچه ها من خیلی وقته لینک دونیت برداشتم، دلیلش هم اینه که به نظرم کار خاصی نمیکنم دیگه که دونیت بشم. اگه یک درصد فکر میکنید که مدیونید یا میخوایید دونیت کنید همون به یک نیازمند تو شهر بدید، یا باهاش بستنی بخرید بخورید :)
18👍1
This media is not supported in your browser
VIEW IN TELEGRAM
دقیقا ۳ سال و ۶ ماه پیش، داستان از اینجا شروع شد...
😁8❤‍🔥1
MAMA
NF
نکته: مادر NF معتاد بود و کلا کودکی خوبی نداشت و فکر کنم مادرش رو مواد اوردز کرد
#music
👍5
خب، یک چیز جالب که فهمیدم(قبلش نمیدونستم 🗿) رو این آقاعه که چشماش بسته است گفت.

بزارید از این ماجرا شروع کنم، تا حالا برای شما پیش اومده که بخوایید یک tuple رو این شکلی بنویسید ولی کار نکنه؟
a = (1)
اتفاقی که میوفته اینه ک a مساوی با integer یک میشه نه tupleای که داخلش یک هست.

و این اتفاق برای این میوفته که پایتون tuple هارو با ویرگول(،) میشناسه نه با پرانتز (این تیکه رو نمیدونستم)
در نتیجه پرانتز صرفا برای شفاف سازی حضور tuple هستش :)
و خوب دلیلش هم اینه که بعد با پرانتز میتونید اولويت هایی مثل opration ها ریاضی ضرب و تقسیم و .. با پرانتز مدریت کنید.

در نتیجه کد زیر هم درست کار میکنه.
a = 1,
print(a)
و این یک tuple میده. نکته خفن تر ماجرا داخل unpacking کرد عه :)) که اون یک ماجرا جداست اگه این پست ۲۰ تا ریکشن 😱 بگیره اون هم مینویسم 😂

@TorhamDevCH
😱34👍6🍾2👎1🌚1👻1😨1
TorhamDev | تورهام 😳
خب، یک چیز جالب که فهمیدم(قبلش نمیدونستم 🗿) رو این آقاعه که چشماش بسته است گفت. بزارید از این ماجرا شروع کنم، تا حالا برای شما پیش اومده که بخوایید یک tuple رو این شکلی بنویسید ولی کار نکنه؟ a = (1) اتفاقی که میوفته اینه ک a مساوی با integer یک میشه نه tupleای…
در پایتون شما هر iterator ‌ای رو میتونید Unpack کنید. اما iterator چیه؟ و Unpacking یعنی چی؟

ساده بخام بگم هر آبجکتی که بشه رو حرکت کرد و دیتا گرفت iterator عه مثل لیست، دیکشنری، تاپل و ...
بهتر بخام بگم هر آبجکتی که متد iter و اگه اشتباه نکنم next رو داره.

خب حالا unpacking کردن چیه؟ آن‌پک کردن یجورایی Map کردن محصوب میشه مثال زیر رو ببینید:
a, b, c = 1, 2, 3
خب از پست قبلی میدونیم که پایتون با ویرگول(،) میاد tuple میسازه پس سمت راستِ مساو، یک tuple. حالا پایتون میاد این tuple رو آن‌پک میکنه و به متغییر‌ها اون ورودی Map میکنه. دونه دونه و به ترتیب در نتیجه a میشه 1 و b میشه 2 و c میشه 3

حالا که اینو میدونید بزاید نظر شمارو به چیز دیگه ای جلب کنم :)
مثال پایین رو ببینید:
def test(*args):
print(args)

test(1, 2, 3)
خروجی این کد چی میشه؟ اگه این کد اجرا کنیم خروجی مثل زیر باید بگیریم
(1, 2, 3)
که آرهههه یک tuple عه :)))))
نکته باحال و هیجان انگیز اینه که پایتون در اصل ورودی های فانشکن unpack میکنه و map میکنه به ورودی ها فانشکن :))) و یکی از دلایلی که نمیتونید بعد یک ورودی a=3 داخل فانشکن ورودی عادی بدون مقدار پاس بدید. چون دیگه نمیتونه unpack و map کنه :)

اگه چیز بیشتری در این باره میدونید تو کامنتها بگید🤝

این پست اگه 20 تا 🤯 بگیره پست بعدی میزارم😂(باج گیری)


@TorhamDevCH
🤯31😁5👍1🌚1
اندکی توصیه دیسکوردی
@TorhamDevCH
2👍1
من ne بودم ولی تو eq میخواستی 😔💔
😁1😢1
WHY
NF
از NF هم بخام یک موزیک بردارم.

خط به خط حق

I could be workin' for 24 hours a day and think I never did enough

#music
❤‍🔥3
مبانی برنامه نویسی رو شدم ۱۳.۵
🤣26🗿3🔥1
خب اینطوری که بوش میاد. ترم یکو باید از اول بخونم
😈8🤣2🙏1
Forwarded from جادی | Jadi
آی بی ام این امکان رو برای عموم فراهم کرده که با سیستم
IBM i
کار کنن. اگر دوست دارین توی این سایت اکانت باز کنین و درک وسیع‌تری از سیستم عامل ها پیدا کنین؛ به هرحال کار کردن روی پاور سیستم و امکان نوشتن سی و فرترن روش جالبه (:

https://pub400.com/
🔥2👎1
بچه‌ها بچه‌ها با نمره ۱۲.۲۹ مشروط نشدم😂🤝 فقط با ۲۹ آخرش و در کل هم ۳ تا امتحان
BROOO😂
👍6👎1🔥1🍾1
بچه‌ها دانشجو بریزید تو گروه @programmer_dudes

گویا اینجا همه دانشجو اند😂🤝
Forwarded from Oh My Task! (Shahriar Shariati)
Gunicorn with Uvicorn inside

I'm up to reading the Gunicorn and Uvicorn source code and playing with the parameters to see the actual process/thread/coroutine management of those. I will write a detailed blog post about it soon but so far I wanna explain to you why it's recommended to use the Gunicorn web server with Uvicorn worker class.

The Gunicorn provides powerful worker management with lots of customizations. Gunicorn manages workers, and workers manage Python web applications. There are two types of workers which are sync and async. The term "async" here is a bit different than the async functions in Python. It's about the way worker serves the requests.

There are a couple of default worker classes in Gunicorn such as sync, eventlet, gevent, torando and gthread. There are differences between request and web application handling in these workers that I will explore in the upcoming blog post. However, none of them can run the async functions in Python. So you will lose the power of this handy process manager for just being in async code style.
Here is the moment that Uvicorn comes. Although the Uvicorn is a standalone web server that runs ASGI applications in Python, but it does not have the abilities of Gunicorn. The great thing that developers of Uvicorn have done is that they developed a Uvicorn worker class based on the basic Gunicorn worker class. So you can easily run the Gunicorn to manage Uvicorn workers, and use this worker to serve incoming requests with async web applications.

To do that you can simply run this command:
gunicorn example:app -w 4 -k uvicorn.workers.UvicornWorker

This command will spawn 4 Uvicorn workers and loads the ASGI application into them. So you have the performance of Gunicorn and Uvicorn together.

You might ask if we should avoid running our apps only with Uvicorn? The answer is not the same for different situations. Sometimes you wanna keep the running process of a web application flat and simple to put it as a single processing unit into Kubernetes pods or Docker containers for better management and debugging. So you should see your structure first.

@OhMyTask