Re: script-with-language-extension
On Mon, Oct 05, 2009 at 01:44:11PM +1100, Ben Finney wrote:
> Matthew Palmer <mpalmer@debian.org> writes:
>
> > So someone's using a single file as both a library and a stand-alone
> > program. Damned silly idea.
>
> Not so silly; a Python module can be useful both as a main program and
> as a re-useable component in other programs. The well-known Python idiom
> of testing ???if __name__ == '__main__'??? is commonly used to make a module
> that can be used in either way.
It can be done in other languages too; doesn't make it a good idea.
- Matt
Reply to: