<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 26, 2010, at 9:31 AM, Guido van Rossum wrote:</div><blockquote type="cite"><div>I would like Gregor Lingl's approval of turning turtle.py into a package. &nbsp;It might make some things harder for novices, e.g. trackebacks and just browsing the source code.<br><br>Also many people don't expect to find any code in a file named __init__.py (and most of the time I agree with this). &nbsp;But the alternative isn't so great either, assuming we'll want strict backwards compatibility (I wouldn't want the instructions in Gregor's or anyone's book to start failing because of this). &nbsp;You can't rename turtle to turtle/turtle.py either, because then there'd be horrible confusion between turtle/ and turtle.py.<br><br>IOW, yes, flat still seems better than nested here!<font class="Apple-style-span" color="#000000"><font class="Apple-style-span" color="#144FAE"><br></font></font></div></blockquote><br></div><div><br></div><div>Thanks for saying this. &nbsp;It might be a good time to also have a discussion about what may be an emerging trend of wanting to split standard library modules into packages.</div><div><br></div><div>I understand the urge to split longer modules into multiple source&nbsp;files but would like to mention some of the advantages of keeping&nbsp;modules in a single source file.</div><div><br></div><div>Taking the decimal module as an example:</div><div><br></div><div>* &nbsp;Right now, I can pull&nbsp;up the source and entire history from subversion by knowing just&nbsp;the module name: &nbsp;&nbsp;<a href="http://svn.python.org/view/python/branches/py3k/Lib/decimal.py?view=markup">http://svn.python.org/view/python/branches/py3k/Lib/decimal.py?view=markup</a>&nbsp;, and I can search the entire module with nothing more sophisticated than "find" in the web browser. &nbsp; That no longer works with unittest.</div><div><br></div><div>* I can easily email the file to someone or copy it back to a previous version of Python because only one file is involved. &nbsp;To look at the code, I don't have to guess how someone would have partitioned it into decimal.context.utils.threadlocal.py or somesuch. &nbsp;I don't need a packaging tool to distribute a module (pyparsing and BeautifulSoup are two examples of tools that are easily managed by just being in one file).</div><div><br></div><div>* Some editors are set up to easily dance across multiple files and directories as if they were a single unit; however, many editors are not. &nbsp;Most file viewers and editors work better with single files. &nbsp; &nbsp;Take two operations in IDLE for example. &nbsp;If I press Alt-M for open module, I can retrieve all of the source for decimal (but this won't work with the logging or unittest packages). &nbsp;Once the source is visible, I press Alt-C to bring up a class browser for quickly reviewing the source (but this also won't work with packages). &nbsp;Several Python editors have this capability (provided by the pyclbr module) but they are defeated by packaging.</div><div><br></div><div>* The Lib directory is more easily grepped when it is flat. &nbsp;The more we nest the Lib directory, the harder it will be to search the sources (while excluding the test directory).</div><div><br></div><div>Packaging is not always wrong. &nbsp;Maybe it was the right thing to do for unittest, maybe not. &nbsp;I just wanted to bring up some of the advantages of having a single file for a library module. &nbsp;It would not be a good thing if some of the newer committers embarked on taking modules over 2000 lines and split them into packages. &nbsp; Right now, we have hundreds of source files, but it wouldn't take long for someone on a packaging mission to turn that into thousands.</div><div><br></div><div>If someone wants to reorganize code for clarity, I would prefer keeping it within one file, bringing related functions together and using comment lines to mark the major sections. &nbsp;ISTM, this is cleaner than introducing a new directory and having multiple files that cross-import one another.</div><div><br></div><div><br></div><div>Raymond</div></body></html>