You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
namedtuple, userlist
userlist : 보다 쉬운 메소드 재정의 가능.(리스트의 메소드를 override하지 않고 접근 가능하기에)
namedtuple : attribute로 접근 가능. -> immutable, 사용x, 새 class생성.
# Python program to demonstrate
# userlist
from collections import UserList
# Creating a List where
# deletion is not allowed
class MyList(UserList):
# Function to stop deletion
# from List
def remove(self, s = None):
raise RuntimeError("Deletion not allowed")
# Function to stop pop from
# List
def pop(self, s = None):
raise RuntimeError("Deletion not allowed")
# Driver's code
L = MyList([1, 2, 3, 4])
print("Original List")
# Inserting to List"
L.append(5)
print("After Insertion")
print(L)
# Deleting From List
L.remove()
The text was updated successfully, but these errors were encountered:
M STACK_Viewer.py
M modules/Command_Autocomplete.py
M modules/Func.py
M modules/config.py
M modules/push.py
A modules/push_Func.py
A modules/push_bak.py
namedtuple, userlist
userlist : 보다 쉬운 메소드 재정의 가능.(리스트의 메소드를 override하지 않고 접근 가능하기에)
namedtuple : attribute로 접근 가능. -> immutable, 사용x, 새 class생성.
The text was updated successfully, but these errors were encountered: