Re: [Tutor] Input validation

2009-09-04 Thread Rich Lovely
2009/9/3 Albert-Jan Roskam : > Hi, > > I'm wondering what is the most common method of input validation. See the > example below. > -Is the code below the most common/recognizable way something like this is > done? > -Which of the options #1 and #2 is the preferred method? Option #2 looks less >

Re: [Tutor] Input validation

2009-09-03 Thread Alan Gauld
"Albert-Jan Roskam" wrote I'm wondering what is the most common method of input validation. Any and all of the methods will work in different situations but its generally best to use duck typing and try to write code that works for any type as far as possible. Then use exceptions to catc

[Tutor] Input validation

2009-09-03 Thread Albert-Jan Roskam
Hi, I'm wondering what is the most common method of input validation. See the example below. -Is the code below the most common/recognizable way something like this is done? -Which of the options #1 and #2 is the preferred method? Option #2 looks less esoteric, but #1 seems better when you have