Telegram Web
Python's namedtuples can be a great alternative to defining a class manually
#pytrick
You can use "json.dumps()" to pretty-print Python dicts
... (as an alternative to the "pprint" module)
#pytrick
بی نهایت در پایتون
پایتون مثبت و منفی بی نهایت واقعی داره! مثلا عددی که هیچ عددی ازش کوچکتر نیست، بدون محدودیت تعداد ارقام!
Python_Labs🐍
بی نهایت در پایتون پایتون مثبت و منفی بی نهایت واقعی داره! مثلا عددی که هیچ عددی ازش کوچکتر نیست، بدون محدودیت تعداد ارقام!
#سوال
تو مثال بالا، به نظرتون خروجی کد زیر True است یا False ؟

negative_inf < negative_inf +1

آیا واقع مثل منفی بی نهایت در ریاضی رفتار میکنه و False بر میگردونه!؟
تو پایتون میتونید از کلاس های پایه ارث برده و متناسب نیازتون override کنید.

How to inherit and extend a list object in Python? (Stackoverflow)
پایتون زبان برنامه نویسی رسمی برای آموزش در فرانسه خواهد شد.

https://twitter.com/nnja/status/1062621193696612352
ممکنه برخورده باشید بعضی مواقع متغیر رشته ای به این صورت است!

b'salam'

Why the 'b's in front of the string? Bytes literals are always prefixed with 'b' or 'B'; they produce an instance of the bytes type instead of the str type. They may only contain ASCII characters; bytes with a numeric value of 128 or greater must be expressed with escapes.

https://stackoverflow.com/questions/6269765/what-does-the-b-character-do-in-front-of-a-string-literal
"is" vs "=="
#pytrick
functools — Higher-order functions and operations on callable objects

partial gives default values to the parameters of a function that would otherwise not have default values.
#pytrick
How to count the occurrence of certain item in an ndarray in Python?

فرض کنید در یک وکتور نامپای منحصر به فردها و تعداشان را میخواهید بدانید...
مناسب برای گرفتم آمار لیبل های دیتاست .

a = numpy.array([0, 3, 0, 1, 0, 1, 2, 1, 0, 0, 0, 0, 1, 3, 4])
unique, counts = numpy.unique(a, return_counts=True)
dict(zip(unique, counts))


{0: 7, 1: 4, 2: 1, 3: 2, 4: 1}
Functions are first-class citizens in Python
#pytrick
Dicts can be used to emulate switch/case statements

#pytrick
سلام.
از دوستانی که کلاس آزمایشگاه متلب داشتند و پایتون ارائه دادم؛ ممنون میشم پاسخ سوال زیر را برایم در خصوصی ارسال کنند. @alirezaweb

یکی از اساتید دیگر دانشگاه به گفته دانشگاه قصد دارد در کارگاه متلب، پایتون ارائه کند.
چه مباحثی از کلاس در چه درسهایی به کارتان آمده و چه مباحثی نیاز بود بیان شود و بیان نشده است؟
Forwarded from Tensorflow(@CVision) (Alireza Akhavan)
#خبر
نامپای روی GPU با قابلیت autodiff و اضافه شدن JIT کامپایلر ...
(Pic: https://www.tgoop.com/cvision/813 )
JAX is NumPy on the CPU and GPU with autodiff and JIT compilation. It's just been released, try it out!

https://github.com/google/jax

همین الان روی گوگل کولب شروع کنید:
https://colab.research.google.com/github/google/jax/blob/master/notebooks/quickstart.ipynb
Python's list comprehensions are awesome

even_squares = [x * x for x in range(10) if not x % 2]

#pytrick
اندیس درایه هایی که از عدد مد نظر بزرگتر است.

np.argwhere
اجتماع و اشتراک در پایتون.
و trickی برای اشتراک چند لیست همزمان!

set.intersection(*map(set,[a, b, c]))
2025/07/14 09:57:04
Back to Top
HTML Embed Code: