Proposal: runtime validation statement

John Roth newsgroups at
Wed Jul 14 14:47:00 CEST 2004

"Paul Rubin" <> wrote in message
news:7xllhohghq.fsf at
> Ville Vainio <ville at> writes:
> > Yes, and I (and many others, I feel) consider print statement a wart
> > in the language. Let's not make any more of these... Too bad it's so
> > widely used it can't be right out deprecated.
> I can sympathize with the notion that print and assert are warts, but
> I think they're considered to be important to Python's
> newbie-friendliness or something like that.  As such, "validate" ought
> to be considered about the same way.

Both statements have specific functions. The problem arises
with people that try to use them for other purposes than
they were intended.

Print is for debugging prints. I use it a lot for that purpose,
and never use it for any "user" output, even though I am
both the programmer and the user in most cases. It
works well when used for the purpose it was intended.

Assert is intended for debugging and program validation.
Using it for standard program logic is using it outside of
its intended purpose. All the complaints I've ever seen
about assert revolve around that.

I don't like the notion of a validate statement for a number
of reasons. One of them is that the proposal doesn't say
what it would do in enough detail for me to figure out
whether I could actually use it. My suspicion is that it
wouldn't fit in with the way I write validation routines
anyway. Clue: I generally don't throw exceptions.
For me, validation logic is tightly tied to the (g)UI
logic, since it's the UI that's going to have to tell the
user that he mucked up.

John Roth

More information about the Python-list mailing list