[Patches] [Patch #100933] base64: move "def test()" into "if __main__" program
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 27 Jul 2000 14:06:53 -0700
Patch #100933 has been updated.
Project:
Category: None
Status: Closed
Summary: base64: move "def test()" into "if __main__" program
Follow-Ups:
Date: 2000-Jul-19 01:43
By: effbot
Comment:
why? it doesn't change anything in real life (the compiler still generates code for that function), except that you can no longer do "import base64; base64.test()"
-------------------------------------------------------
Date: 2000-Jul-19 01:59
By: hooft
Comment:
Exactly. base64.test() actually waits for stdin, which is a bit annoying. I wrote an accompanying message on c.l.py explaining that there are ~20 modules that define a test() this way, some 15 others define _test(). The latter is already a lot better for the unhappy few that use "from base64 import *". But you're right: actually I think the whole test business should be moved to the test-suite, such that no space is taken by dead code in
user programs.
-------------------------------------------------------
Date: 2000-Jul-19 02:47
By: moshez
Comment:
I'm -1 on this patch. test() is useful enough when you import base64. Why deny this functionality? It doesn't save any parsing time for the common case!
-------------------------------------------------------
Date: 2000-Jul-19 02:53
By: hooft
Comment:
Please note that the test() and test1() are undocumented hence surprising. Moving them does not deny any described functionality.
Wow... This patch proposal is generating some comments...
-------------------------------------------------------
Date: 2000-Jul-19 04:33
By: twouters
Comment:
Note that Guido already revoked a patch made by Eric Raymond that did the same (to a different module.) I think we can safely say this one is rejected in advance.
Also, it might break stuff. test() might not be documented, but I think it's bad form to move something just for the hell of it. I'd rather break someone's habit of 'from base64 import *' than the habit of reading a module source and seeing a nifty function that isn't documented externally.
test1(), though, is a different story. I have no problem with renaming that to _test1().
-------------------------------------------------------
Date: 2000-Jul-19 04:40
By: hooft
Comment:
I give up :-) Hope you're all not too angry with me for spoiling your time. Here is a new version of the patch that just renames test1, and corrects the usage message.
-------------------------------------------------------
Date: 2000-Jul-25 07:35
By: jhylton
Comment:
I applied part of the patch, but did not change the name of test1. (Applying the adage "If it ain't broke, don't fix it.")
-------------------------------------------------------
-------------------------------------------------------
For more info, visit:
http://sourceforge.net/patch/?func=detailpatch&patch_id=100933&group_id=5470