[Tutor] Input

Ricardo Aráoz ricaraoz at gmail.com
Wed Jan 16 10:18:57 CET 2008


Tiger12506 wrote:
>> Of course I know and use reg. exps., the point of the function is not to
>> validate input but to force the proper input.
> 
> So? Are you going to try to tell me that you can force particular input 
> without actually determining if its valid or not first? ;-)
> 
> Just a thought. 
> 


Are you going to try to tell me that it is better to check if ONE
character is valid with a reg.exp. that with a simple 'in' statement?

The purpose of the code is not to check input but to force it a
character at a time according to an input mask, it's a common enough
concept. Just do a bunch of raw_inputs inscribed in while loops with
their validations, then do it with this function and check the
readability of your code (not to talk about the length). Anyway it was
presented as a help for those who want it and as an exercise program to
be improved and learn from.




More information about the Tutor mailing list