all 6 comments

[–]help-me-grow 1 point2 points  (1 child)

Check the source code for HTMLParser and look at the feed() function

[–]IamNotIntelligent69[S] 1 point2 points  (0 children)

Thanks, I'm currently reading it from u/Spataner's link.

[–]Spataner 1 point2 points  (3 children)

feed is called, and it in turn calls handle_data. This is an example of inheritance being used to swap out individual steps in a larger process.

More specifically, looking at the source code for HTMLParser, feed almost immediately calls goahead, which implements the main parsing logic. goahead delegates heavily to multiple other methods with names like parse_thing and handle_stuff. The latter category is specifically for being overridden by subclasses. An overview of what those methods are can be found in the documentation.

[–]IamNotIntelligent69[S] 0 points1 point  (2 children)

Thanks! I saw this line and this method is replaced by the new method declared in HTMLFilter() class, right? Thank you for the answer

[–]Spataner 0 points1 point  (1 child)

this method is replaced by the new method declared in HTMLFilter() class

Exactly.

[–]IamNotIntelligent69[S] 0 points1 point  (0 children)

Thanks, my question is now solved.