Proposal: runtime validation statement

Dave Brueck dave at pythonapocrypha.com
Mon Jul 12 13:29:34 EDT 2004


Ville Vainio wrote:

>>>>>>"Dave" == Dave Brueck <dave at pythonapocrypha.com> writes:
> 
> 
>     Dave> Also, a developer-defined function doesn't stand out as well
>     Dave> as a statement would - a statement sets it apart from normal
>     Dave> function calls which are doing the actual work to solve the
>     Dave> problem at hand - and it'd be easy for syntax-highlighting
>     Dave> editors to color it differently too.
> 
> It's as easy to color a function.
> 
> We have too much statements that don't need to be statements
> already. "validate" is obvious library stuff...

I disagree - there's a clear distinction between solving the problem and 
e.g. validating inputs to the problem solver, and having such checks as 
a statement is a good way to implement that distinction. That's why 
'assert' as a statement makes sense to me too - it and validate are sort 
of "out of band" with getting the actual work done, but useful nonetheless.

Whether or not a validate keyword is a good idea should be judged 
independently of your opinion of whether or not 'print' is a wart.

It's definitely not "obvious library stuff" IMO - if nothing else, 
making you import a library just to validate parameters is goofy. It 
would be semi-tolerable (though less than ideal) as a builtin.

-Dave




More information about the Python-list mailing list