My Python annoyances

Ben Collver collver at peak.org
Fri May 4 10:22:34 EDT 2007


Ben Collver wrote:
> Chris Mellon wrote:
>> Code like this is working directly against Python philosophy. You
>> probably got told this on #python, too. There's hardly any
>> circumstance where you should need to validate the exact class of an
>> object, and as long as they have the same interface theres no harm
>> whatsoever in tempfile changing it's return value between Python
>> versions.
> 
> I am unqualified to comment on the Python philosophy, but I would like 
> for my function to do some basic error checking on its arguments.

By "basic error checking" I mean "verify that the file argument actually 
is a file-like object".  By same interface, do you mean that I should 
check for the methods that I depend on?  That sounds easy enough.

Thanks for the hint,

Ben



More information about the Python-list mailing list