Does order of defining classes matter? #6009
Replies: 1 comment
-
|
The order is irrelevant as long as all classes are registered before any of the bound methods is actually invoked from Python — which, for the pattern in your snippet (everything inside one The mechanism:
Inside a single Where it does start to matter:
For your |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Suppose you are declaring classes. Sometimes a method of one class returns another class. I wonder, is it needed for the class that is e.g. returned, to be defined before the method that uses it, or is the order irrelevant?
As an example:
This seems to work fine, despite
Bookbeing declared afterFindBook, whereFindBookreturnsBook*. So it seems that things are resolved in some deferred/lazy way. Still, I couldn't find documentation about this, and perhaps things are only working by chance.Can I rely on the order of class definitions being irrelevant, as far as return types and argument types go?
Beta Was this translation helpful? Give feedback.
All reactions