توضیحات
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 learnand how you can apply it Learn how to implement a state machine or an object that operates in a number of different states, but doesnt 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 learnand how you can apply it Learn how to implement a state machine or an object that operates in a number of different states, but doesnt 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
این درس دستور العملی از کتاب آشپزی پایتون است که مشکل پیادهسازی یک ماشین حالت یا یک شی را که در چندین حالت مختلف کار میکند، بدون پر کردن کد شما با شرطیهای زیاد بررسی میکند. راهحلهای کلیدی مانند رمزگذاری هر حالت عملیاتی به عنوان یک کلاس جداگانه و ترتیب دادن یک کلاس برای تفویض اختیار به کلاس دیگر، یا دستکاری مستقیم ویژگیهای خاص نمونهها را آموزش میدهد. آنچه یاد خواهید گرفت و چگونه می توانید آن را اعمال کنید یاد بگیرید که چگونه یک ماشین حالت یا یک شی را پیاده سازی کنید که در چندین حالت مختلف کار می کند، اما کد شما را با شرطی های زیادی پر نمی کند. همچنین یاد خواهید گرفت که چگونه هر حالت عملیاتی را به عنوان یک کلاس جداگانه رمزگذاری کنید و ترتیبی دهید که یک کلاس به کلاس دیگر واگذار شود. در نهایت، نحوه دستکاری مستقیم ویژگی کلاس نمونه ها را ببینید. این درس برای شما مناسب است زیرا شما یک برنامه نویس باتجربه پایتون هستید که به دنبال تعمیق درک خود از زبان و اصطلاحات برنامه نویسی مدرن، مانند تکنیک های پیشرفته ای است که توسط کتابخانه ها، چارچوب ها و برنامه ها استفاده می شود. پیش نیازها تجربه متوسط به عنوان یک برنامه نویس پایتون مواد یا دانلود لازم نیست ادامه مطلب…
نقد و بررسیها
هنوز بررسیای ثبت نشده است.