- عنوان کتاب: Python Advanced Programming
- نویسنده: Marcus Richards
- حوزه: برنامه نویسی پایتون
- سال انتشار: 2024
- تعداد صفحه: 185
- زبان اصلی: انگلیسی
- نوع فایل: pdf
- حجم فایل: 1.14 مگابایت
در این فصل، دامنه وسیعی از روشهای برنامهنویسی را بررسی میکنیم و ساختار ریشهشناختی پایتون را ارائه میکنیم. بخشهایی از مطالب در این بخش بسیار تلاشکننده است، اما به یاد داشته باشید که پویاترین تکنیکها در حال حاضر و بارها مورد نیاز است و شما معمولاً میتوانید از روشهای اولیه عبور کنید تا ایدهای در مورد آنچه که باید قابل تصور باشد و در صورت افزایش نیاز، با دقت بیشتری بررسی کنید. منطقه اول این بخش عمیق تر به نکات برجسته رویه ای پایتون می پردازد. این با بیان بهترین راه برای استفاده از آنچه قبلاً به شیوهای بدیع بررسی کردهایم آغاز میشود و پس از آن سود به موضوع ژنراتورها میرسد. بخش در آن نقطه برنامه نویسی پویا را ارائه می دهد – ماژول ها را بر اساس نام در زمان اجرا روی هم قرار می دهد و کدهای خوداظهاری را در زمان اجرا اجرا می کند. این منطقه به موضوع ظرفیتهای نزدیک (مستقر) برمیگردد، اما آنچه بیشتر است استفاده از واژهنامه غیرمحلی و ظرفیتهای بازگشتی را پوشش میدهد. قبلاً نحوه استفاده از دکوراتورهای از پیش تعریف شده پایتون را درک کرده بودیم – در این بخش متوجه میشویم که چگونه دکوراتورهای خود را بسازیم. منطقه با گنجاندن حاشیه نویسی به پایان می رسد. بخش دوم تمام مطالب جدید مربوط به برنامه نویسی شی گرا را پوشش می دهد. با معرفی __slots__، مکانیزمی برای به حداقل رساندن حافظه استفاده شده توسط هر شی شروع می شود. سپس نحوه دسترسی به ویژگیهای شی را بدون استفاده از ویژگیهای آن نشان میدهد. این بخش همچنین تابعها و مدیران زمینه را توضیح میدهد – اینها همراه با کلمه کلیدی with استفاده میشوند، و در بسیاری از موارد (به عنوان مثال، مدیریت فایل) میتوان از آنها برای جایگزینی try … استفاده کرد، به جز … در نهایت ساختها با تلاش سادهتر … به جز ساختارها. این بخش همچنین نحوه ایجاد مدیران زمینه سفارشی را نشان میدهد و ویژگیهای پیشرفته دیگری از جمله دکوراتورهای کلاس، کلاسهای پایه انتزاعی، وراثت چندگانه و متاکلاسها را معرفی میکند.
In this Chapter we will investigate a wide scope of programming methodologies and present various extra, consistently further created, Python etymological structure. Bits of the material in this segment is very trying, yet recall that the most dynamic techniques are now and again required and you can commonly skim the primary go through to get an idea of what should be conceivable and scrutinized even more circumspectly when the need rises. The part’s first area delves all the more profoundly into Python’s procedural highlights. It begins by telling the best way to utilize what we previously canvassed in a novel manner, and after that profits to the topic of generators. The segment at that point presents dynamic programming—stacking modules by name at runtime and executing self-assertive code at runtime. The area comes back to the subject of nearby (settled) capacities, however what’s more covers the utilization of the nonlocal watchword and recursive capacities. Prior we perceived how to utilize Python’s predefined decorators—in this segment we figure out how to make our own decorators. The area finishes up with inclusion of annotations. The second part covers all new material relating to object-oriented programming. It starts by the introduction of __slots__, a mechanism to minimize the memory used by any object. Then, it shows how to access object attributes without using its properties. The section also describes functors, and context managers—these are used in conjunction with the with keyword, and in many cases (e.g., file handling) they can be used to replace try … except … finally constructs with simpler try … except constructs. The section also shows how to create custom context managers, and introduces additional advanced features, including class decorators, abstract base classes, multiple inheritance, and metaclasses.
این کتاب را میتوانید از لینک زیر بصورت رایگان دانلود کنید:
Download: Python Advanced Programming
نظرات کاربران