Python style: to check or not to check args and data members

Joel Hedlund yohell at ifm.liu.se
Fri Sep 1 04:26:07 EDT 2006


Bruno >> Your email address seem to be wrong. I tried to reply to you 
directly in order to avoid thread bloat but my mail bounced.

Thanks for the quick reply though. I've skimmed through some docs on your 
suggestions and I'll be sure to read up on them properly later. But as I 
said to Robert Kern in this thread, this does not really seem resolve the
problem of setting an approprate level of validation.

How do you do it? Please reply to the group if you can find the time.

Cheers!
/Joel Hedlund

Bruno Desthuilliers wrote:
> Joel Hedlund a écrit :
>> Hi!
>>
>> The question of type checking/enforcing has bothered me for a while, 
> (snip)
>> I've also whipped up some examples in order to put the above questions 
>> in context and for your amusement. :-)
> (snip)
>> These are the attached modules:
>>
>> * nocheck_module.py:
>>   As the above example, but with docs. No type checking.
>>
>> * property_module.py
>>   Type checking of data members using properties.
>>
>> * methodcheck_module.py
>>   Type checking of args within methods.
>>
>> * decorator_module.py
>>   Type checking of args using method decorators.
>>
>> * maximum_security_module.py
>>   Decorator and property type checking.
> 
> You forgot two other possible solutions (that can be mixed):
> - using custom descriptors
> - using FormEncode
> 
> 



More information about the Python-list mailing list