Guido van Rossum wrote:
Code that wants to validate a string the user typed as input. Web forms just don't work that way.
Maybe "validation" was a misleading term to use. To be more precise, I'm talking about taking input to the program (it needn't come directly from a user, it could be read from a file or database) that is supposed to be the name of a Color, and turning it into a Color instance. For that purpose, it's convenient to have a function with only two possible outcomes: it either returns a Color instance, or raises a ValueError. The point is that you *shouldn't* have to perform a separate validation step. You should be able to use EAFP -- go ahead and perform the conversion, but be prepared to catch a ValueError at some level and report it to the user. -- Greg _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com