samedi 26 novembre 2022

How do objects with arbitrary attributes gets implemented? [closed]

Irrespective of the value of x, the code

from bs4 import BeautifulSoup
import requests

source = requests.get("https://google.com").text
soup = BeautifulSoup(source, 'lxml')
obj = soup.x

never throws an AttributeError, which is what happens when we try to invoke an undefined attribute of an object.

I just can't visualize the kind of construct responsible for this functionality, nor can I decipher the source code of beautifulsoup. Can anyone enlighten me?

Aucun commentaire:

Enregistrer un commentaire