3 ms·
You're confused. There are no forward references in python. It's simply that identifiers in the body of a function aren't resolved until the function itself is
by almostgotcaught 2y ago
You're confused. There are no forward references in python. It's simply that identifiers in the body of a function aren't resolved until the function itself is executed (if ever) and at the point everything in the module scope has been defined. You can test this yourself by just putting any name into a body and loading the module.
- pansa2 2y ago> identifiers in the body of a function aren't resolved until the function itself is executed (if ever) and at the point everything in the module scope has been defined Yes, so within a function you can refer to things that are defined later in the module. Isn't that's a "forward reference", even if the details are slightly different from how they work in D?
- almostgotcaught 2y ago[flagged]
- pansa2 2y agoYou're right, it's not the same mechanism. But in this particular context it has the same effect - it allows you to define functions in a source file in arbitrary order.