Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Impara Summary | Magic Methods
In-Depth Python OOP

book
Summary

Now, look at the code that you have written and describe this for yourself:

python
from abc import ABC, abstractmethod


class AuthMixin:
is_authenticated = False
def login(self, taken_password):
if self.password == taken_password:
self.is_authenticated = True
print(f"{self.username} is authenticated")
else:
print("Wrong password!")

def logout(self):
self.is_authenticated = False
print(f"{self.username} is loggouted")


class AbstractAdmin(ABC):
@abstractmethod
def login():
pass
@abstractmethod
def logout():
pass
@abstractmethod
def create_content():
pass
@abstractmethod
def update_content():
pass
@abstractmethod

You can understand this code with 85 lines. Congratulations!
You have mastered Object-Oriented Programming in Python and can use the necessary functionality!

1. Remember all OOP concepts:

2. What are magic methods?

question mark

Remember all OOP concepts:

Select the correct answer

question mark

What are magic methods?

Select the correct answer

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 5. Capitolo 6
some-alt