분류 전체보기408 Initialization and Cleanup Python 3 Patterns, Recipes and Idioms latest Contributors ToDo List The remainder are from context, from the book. A Note To Readers Introduction Teaching Support Book Development Rules Developer Guide Part I: Foundations Python for Programmers Initialization and Cleanup Initialization Constructor Calls __new__() vs. __init__() Static Fields Cleanup Further Reading Unit Testing & Test-Driven Dev.. 2023. 3. 31. 파이썬 메직 메서드 파이썬 메직 메서드 1. 객체 속성관련 - getattr, setattr, hasattr, delattr 1) getattr 메서드 - 속성의 값 반환 (지정 속성이 미 존재시 반환할 값 설정) class Employee: comp = "Amazon" age = 30 address = 'seoul' def __getattr__(self,attr_name:str): """ attr_name에 전달된 속성이 존재하지 않을 시 반환할 값 지정 attr_name type은 꼭 str이다. """ return attr_name + ' is not exist.' e = Employee() print(e.age) # 30 print(e.emp_age) # emp_age is not exist. 다른 방식의 적용 ge.. 2023. 3. 30. The Singleton Pattern pattern 이 패턴은 클래스의 인스턴스화를 하나의 객체로 제한합니다. 생성 패턴의 한 유형이며 메서드와 지정된 개체를 생성하는 데 하나의 클래스만 포함됩니다. 생성된 인스턴스에 대한 글로벌 액세스 지점을 제공합니다. class Singleton: __instance = None def __init__(self): """ Virtually private constructor. """ if Singleton.__instance != None: raise Exception("This class is a singleton!") else: Singleton.__instance = self @staticmethod def getInstance(): """ Static access method. """ if Si.. 2023. 3. 29. The Proxy Pattern The Proxy Pattern – Controlling Object Access In the previous chapter, we started with a brief introduction to Structural patterns and went ahead to discuss about the Façade design pattern. We understood the concept of Façade with a UML diagram and also learned how it's applied in the real world with the help of Python implementations. You learned about the upsides and downsides of the Façad.. 2023. 3. 29. The Façade Pattern The Façade Pattern – Being Adaptive with Façade In the previous chapter, you learned about the Factory design pattern. We discussed about three variations—Simple Factory, Factory method, and Abstract Factory pattern. You also learned how each of them is used in the real world and looked at Python implementations. We also compared the Factory method with Abstract Factory patterns and listed the p.. 2023. 3. 29. The Factory Pattern The Factory Pattern – Building Factories to Create Objects In the previous chapter, you learned about Singleton design patterns—what they are and how they are used in the real world along with the Python implementation. The Singleton design pattern is one of the Creational design patterns. In this chapter, we move ahead and learn about another creational pattern, the Factory pattern. The Factory.. 2023. 3. 29. The Singleton Design Pattern The Singleton Design Pattern In the previous chapter, we explored design patterns and their classifications. As we are aware, design patterns can be classified under three main categories: structural, behavioral, and creational patterns. In this chapter, we will go through the Singleton design pattern—one of the simplest and well-known Creational design patterns used in application development. .. 2023. 3. 29. Introduction to Design Patterns Topics in this chapter: Understanding object-oriented programming Discussing object-oriented design principles Understanding the concept of design patterns and their taxonomy and context Discussing patterns for dynamic languages Classifying patterns—creational pattern, structural pattern, and behavioral pattern Understanding object-oriented programming Before you start learning about design patt.. 2023. 3. 29. Index What this book covers Chapter 1, Introduction to Design Patterns, goes through the basics of object-oriented programming and discusses object-oriented design principles in detail. This chapter gives a brief introduction to the concept of design patterns so that you will be able to appreciate the context and application of design patterns in software development. Chapter 2, The Singleton Design P.. 2023. 3. 29. 이전 1 ··· 21 22 23 24 25 26 27 ··· 46 다음