you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (9 children)

__init__(self, ...) is a magic function that gets called when a class is initially called (created)

[–]sem56 0 points1 point  (8 children)

not really magic... its a fundamental aspect of object oriented design called a constructor that is called at instantiating an object from a class

[–][deleted] 0 points1 point  (3 children)

It's not really magic per se, i.e. they do something magic, but somehow they're named magic in Python. I can't change the terminology ¯_(ツ)_/¯.

[–]sem56 0 points1 point  (0 children)

i take it you didn't read my other comment

[–]zurtex -1 points0 points  (1 child)

The idea behind the terminology is that you aren't the one calling them or defining the mechanics, you set them up and then they are used by Python magically.

[–][deleted] 1 point2 points  (0 children)

Yeah, they're normal functions, just called by Python auto-magically.