Hi Alex and Christophe In Python that __name__ variable stops things like a local main proc from executing altogether...when Python detects that the module in which it exists no longer needs it because it is being loaded by a bigger program, which accesses the module's code like the local main does i.e. The local main is hidden from Python under such circumstances.
I was wondering about the "once" situation too....because I have experienced "function redeclared" or some such popping up. If you're telling me that such messages are inconsequential compared to the benefits of developing in a way which causes that.....that's fine by me because it's easier to ignore the redeclaration messages than not :) Because PL seems to allow forward referencing...I was.... 1 Putting all the scaffolding down the bottom with my local main so it's all in the same place. 2 Commenting it all out... 3 Loading the module into the wider program and then 4 Comment the helper functions back in as PL reported their absence. Obviously the local main stays commented out. This seems fairly convenient but my interpretation of the above is I only need to comment out the local main and if that's right that's great. Thank you Chrostophe for the further explanation re Python. Best Regards Dean On 8 February 2017 at 14:47, Christophe Gragnic <[email protected] > wrote: > On Wed, Feb 8, 2017 at 12:13 PM, Alexander Burger <[email protected]> > wrote: > >> I'm thinking of Python's `if __name__ == '__main__' and Perl's unless > >> (caller) {...} > > > > I don't know Python and Perl well enough. But perhaps 'once' is what you > think > > of? > > > > (once (load "xxx.l")) > > No, it's different. > > In Python there's a «magic» variable named __name__. > As files can be: > - imported from another script/module > - interpreted directly from top leve > it provides a trick to distinguish between those two ways to use a > script/module. > See here: > https://docs.python.org/3/library/__main__.html > > > chri > -- > UNSUBSCRIBE: mailto:[email protected]?subjectUnsubscribe >
