Path: csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: Python code file prototype Date: Fri, 17 Feb 2012 17:02:31 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 47 Message-ID: References: <66ea0353-02ee-4152-947a-97b44ff3ec45@p7g2000yqk.googlegroups.com> NNTP-Posting-Host: 208-38-194-91.mammothnetworks.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reader1.panix.com 1329498151 9752 208.38.194.91 (17 Feb 2012 17:02:31 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Fri, 17 Feb 2012 17:02:31 +0000 (UTC) User-Agent: slrn/0.9.9p1 (Linux) Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:20558 On 2012-02-17, John Gordon wrote: > In <66ea0353-02ee-4152-947a-97b44ff3ec45@p7g2000yqk.googlegroups.com> Bruce Eckel writes: > >> There's an option when you do this to insert default file contents, so >> I began searching the web for some kind of prototype Python file that >> would be appropriate to start with. I'm certain I've seen this before >> and that there's been discussions about the best starting point for a >> python code file, but I find I can't get any search hits for it. > > Here's what PyScripter inserts in a new python file: > > #--------------------------------------------------------------------- > # Name: module1 > # Purpose: > # > # Author: $USERNAME > # > # Created: $DATE > # Copyright: (c) $USERNAME $YEAR > # Licence: > #--------------------------------------------------------------------- > #!/usr/bin/env python > > def main(): > pass > > if __name__ == '__main__': > main() > > > Where $USERNAME, $DATE and $YEAR are expanded to the actual values. That's just plain broken. The "#!" line has to be first thing in the file for it to be recognized. Apart from that, my personal opinion is that comment blocks like that are bad practice. They're too often wrong (e.g. file got copied modified, but comment block not updated), and the right place for metadata like that is the filesystem and the source-control system (git, mercurial, subversion, CVS, whatever -- anything but VSS). -- Grant