
۴۴٬۰۰۰تومان
نوع فایل دانلود: EPUB
پس از خرید، یک فایل EPUB دریافت میکنید.
این فایل با Calibre، Apple Books و سایر کتابخوانهای دیجیتال مناسب است.
این درس یک دستورالعمل از کتاب Python Cookbook است و به این مسئله میپردازد که چطور یک ماشین حالت یا شیئی بسازید که در چند حالت مختلف کار کند، بدون اینکه کدتان پر از شرطهای پراکنده شود. راهحلهای اصلیای را آموزش میدهد مثل اینکه هر حالت عملیاتی را بهصورت یک کلاس جداگانه تعریف کنید و کاری کنید که یک کلاس کار را به کلاس دیگر واگذار کند، یا بعضی ویژگیهای نمونهها را مستقیماً تغییر دهید.
آنچه یاد میگیرید—و چطور از آن استفاده میکنید
یاد میگیرید چطور یک ماشین حالت یا شیئی بسازید که در چند حالت مختلف کار کند، اما کدتان را پر از شرطهای زیاد نکند. همچنین یاد میگیرید چطور هر حالت عملیاتی را بهصورت یک کلاس جداگانه بنویسید و یک کلاس را طوری تنظیم کنید که کار را به کلاس دیگر بسپارد. در پایان میبینید چطور ویژگی کلاس نمونهها را مستقیماً تغییر دهید.
این درس برای شماست چون...
یک برنامهنویس با تجربهٔ پایتون هستید و میخواهید درکتان از زبان و اصطلاحات مدرن برنامهنویسی را عمیقتر کنید؛ از جمله تکنیکهای پیشرفتهای که در کتابخانهها، چارچوبها و برنامهها به کار میروند.
پیشنیازها
تجربهٔ متوسط بهعنوان برنامهنویس پایتون
مواد یا فایلهای مورد نیاز
هیچ
ادامه مطلب...
چکیده: این درس یک دستورالعمل از کتاب Python Cookbook است و به این مسئله میپردازد که چطور یک ماشین حالت یا شیئی بسازید که در چند حالت مختلف کار کند، بدون اینکه کدتان پر از شرطهای پراکنده شود. راهحلهای اصلیای را آموزش میدهد مثل اینکه هر حالت عملیاتی را بهصورت یک کلاس جداگانه تعریف کنید و کاری کنید که یک کلاس کار را به کلاس دیگر واگذار کند، یا بعضی ویژگیهای نمونهها را مستقیماً تغییر دهید. آنچه یاد میگیرید—و چطور از آن استفاده میکنید یاد میگیرید چطور یک ماشین حالت یا شیئی بسازید که در چند حالت مختلف کار کند، اما کدتان را پر از شرطهای زیاد نکند. همچنین یاد میگیرید چطور هر حالت عملیاتی را بهصورت یک کلاس جداگانه بنویسید و یک کلاس را طوری تنظیم کنید که کار را به کلاس دیگر بسپارد. در پایان میبینید چطور ویژگی کلاس نمونهها را مستقیماً تغییر دهید. این درس برای شماست چون... یک برنامهنویس با تجربهٔ پایتون هستید و میخواهید درکتان از زبان و اصطلاحات مدرن برنامهنویسی را عمیقتر کنید؛ از جمله تکنیکهای پیشرفتهای که در کتابخانهها، چارچوبها و برنامهها به کار میروند. پیشنیازها تجربهٔ متوسط بهعنوان برنامهنویس پایتون مواد یا فایلهای مورد نیاز هیچ
This lesson is a recipe from the Python Cookbook that explores the problem of wanting to implement a state machine or an object that operates in a number of different states, without littering your code with a lot of conditionals. It teaches key solutions such as encoding each operational state as a separate class and arranging for one class to delegate to another class, or directly manipulating certain attributes of instances. What you'll learn—and how you can apply it Learn how to implement a state machine or an object that operates in a number of different states, but doesn’t litter your code with a lot of conditionals. You'll also learn how to encode each operational state as a separate class and arrange for one class to delegate to the other class. Finally, see how to directly manipulate the class attribute of instances. This lesson is for you because... You're an experienced Python programmers who is looking to deepen your understanding of the language and modern programming idioms, such as the advanced techniques used by libraries, frameworks, and applications. Prerequisites Moderate experience as a Python programmer Materials or downloads needed none Read more...Abstract: This lesson is a recipe from the Python Cookbook that explores the problem of wanting to implement a state machine or an object that operates in a number of different states, without littering your code with a lot of conditionals. It teaches key solutions such as encoding each operational state as a separate class and arranging for one class to delegate to another class, or directly manipulating certain attributes of instances. What you'll learn—and how you can apply it Learn how to implement a state machine or an object that operates in a number of different states, but doesn’t litter your code with a lot of conditionals. You'll also learn how to encode each operational state as a separate class and arrange for one class to delegate to the other class. Finally, see how to directly manipulate the class attribute of instances. This lesson is for you because... You're an experienced Python programmers who is looking to deepen your understanding of the language and modern programming idioms, such as the advanced techniques used by libraries, frameworks, and applications. Prerequisites Moderate experience as a Python programmer Materials or downloads needed none