[Python-checkins] python/dist/src/Lib ftplib.py,1.66,1.67

Jack Jansen Jack.Jansen@cwi.nl
Wed, 8 May 2002 17:39:50 +0200


On Wednesday, May 8, 2002, at 10:56 , loewis@sourceforge.net wrote:

> Update of /cvsroot/python/python/dist/src/Lib
> In directory usw-pr-cvs1:/tmp/cvs-serv8144/Lib
>
> Modified Files:
> 	ftplib.py
> Log Message:
> Patch #553277: Accept callbacks that are callable, not callbacks that 
> are true.

Is this patch a good idea? Now you can pass all sorts of garbage as 
callback (callback="hello") and it'll be silently ignored. I would think 
something like "if not callback is None:" or so would be better...

And in general I think it's unwise in Python to have an object that 
tests false (because it's __len__ returns 0, in the case of this bug 
report) but is still expected to do something. "if object: 
do_something_with(object)" is fairly standard Python idiom.
--
- Jack Jansen        <Jack.Jansen@oratrix.com>        
http://www.cwi.nl/~jack -
- If I can't dance I don't want to be part of your revolution -- Emma 
Goldman -