분류 전체보기402 Static Methods https://www.pythontutorial.net/python-oop/python-static-methods/ Python Static Methods Explained Clearly By Practical Examples In this tutorial, you'll learn about Python static methods and how to use define utility methods for a class. www.pythontutorial.net Introduction to Python static methods instance method는 바인딩된 개체의 상태에 액세스하고 수정할 수 있다. class method는 클래스 상태에 액세스하고 수정할 수 있습니다. static method는.. 2023. 3. 31. __new__() Method https://www.pythontutorial.net/python-oop/python-__new__/ Python __new__ In this tutorial, you'll learn about the Python __new__ method and understand how Python uses it to create a new object. www.pythontutorial.net 파이썬 __new__ 메서드 소개 1. 클래스의 인스턴스를 만들 때 Python은 먼저 __new__() method를 호출하여 객체를 생성한 다음 __init__() method를 호출하여 객체의 속성을 초기화합니다. 2. __new__()는 object Class 의 static method입니다. 3. [수동 객체 생.. 2023. 3. 31. [ OOP ] Index CLASSES & OBJECTS Python Object-oriented Programming - callable Class Class Variables 함수& Methods __init__: Initializing Instance Attributes Instance Variables Private Attributes Class Attributes Static Methods - class methods SPECIAL METHODS __str__ __repr__ __eq__ __hash__ __bool__ __del__ PROPERTY Property @property Decorator Readonly Property Delete Property SINGLE INHERITANCE Inheritance Ov.. 2023. 3. 31. 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. 이전 1 ··· 20 21 22 23 24 25 26 ··· 45 다음