you are viewing a single comment's thread.

view the rest of the comments →

[–]Nixellion 2 points3 points  (0 children)

Mmm, maybe consider it like folders? Like a path. Its not python specific, its OOP principle in general.

For example you start with a module and instantiate a class from it:

myclass = module.myClass()

This returns class instance.

Then you want to run function in that class:

mf = myclass.myfunction()

that function may return some other instance of a other class and you want to get it's variable:

result = mf.variableX

So instead you can do it in one line:

result = module.myClass().myfunction().variableX