Code Verse
159 subscribers
84 photos
29 files
4 links
Download Telegram
‏9. یک generator بساز که مقدار بگیرد (send) و وقتی عدد منفی فرستاده شد، exception پرتاب کند و ادامه دهد.

#question #python

🌌 @the_code_Verse 🪐
4👎1
‏10. چرا نمی‌توان یک dictionary را مستقیماً به تابعی که lru_cache@ دارد پاس داد؟ راه حل چیست؟

#question #python

🌌 @the_code_Verse 🪐
👎1🔥1
11. تفاوت دقیق بین new و init در کلاس‌ها چیست؟ چه زمانی فقط new اجرا می‌شود و init نه؟

#question #python

🌌 @the_code_Verse 🪐
👍1👎1
init_vs_new.pdf
353.2 KB
جواب سوال ۱۱ پایتون
تعداد صفحه: ۳

کلید واژه‌ها:
__new__, __init__, descriptor, singleton design pattern, NoneType

#answer #python

🌌 @the_code_Verse 🪐
👎1
12. رفتار super() در diamond inheritance با ۴ کلاس چگونه است؟ مثال با ترتیب پیچیده متدها بده.

#question #python

🌌 @the_code_Verse 🪐
👍2👎1
super_in_diamond_inheritance.pdf
445.2 KB
جواب سوال ۱۲ پایتون
تعداد صفحه: ۶

پیش‌نیازها:
توضیحات MRO
توضیحات descriptor

کلید واژه‌ها:
closure cell, super, descriptor, __class__, __self__, __build_class__, bound method, @static_method

#answer #python

🌌 @the_code_Verse 🪐
👍2
‏13. تفاوت و کاربرد WeakSet و WeakKeyDictionary را توضیح بده و مثالی از cache اشیاء بده.

#question #python

🌌 @the_code_Verse 🪐
2👎1
weak_set_vs_weak_dictionary.pdf
403.5 KB
جواب سوال ۱۳ پایتون
تعداد صفحه: ۴

پیش‌‌نیازها:
توضیحات weakref

کلیدواژه‌ها:
weakref, WeakSet, WeakKeyDictionary, WeakValueDictionary, cache

#answer #python

🌌 @the_code_Verse 🪐
2👎1
14. چگونه می‌توان یک decorator نوشت که attributeهای کلاس را قبل از تعریف متدها تغییر دهد؟

#question #python

🌌 @the_code_Verse 🪐
1👎1
class_decorator.pdf
192.6 KB
جواب سوال ۱۴ پایتون
تعداد صفحه: ۱

کلیدواژه‌ها:
decorator, attribute, metaclass , __dict__

#answer #python

🌌 @the_code_Verse 🪐
4👎1
15. چه تفاوتی بین @staticmethod و @classmethod و متد معمولی در inheritance دارد؟

#question #python

🌌 @the_code_Verse 🪐
👎3