Re: [Tutor] value range checker

2015-08-28 Thread Alan Gauld
On 26/08/15 17:29, Alan Gauld wrote: def make_validator(min, max, *values): def validate(value): return (min <= value <= max) or value in *values) return validator Oops! Should of course be return validate Sorry, -- Alan G Author of the Learn to Program web site ht

Re: [Tutor] value range checker

2015-08-28 Thread Albert-Jan Roskam
> Subject: Re: value range checker > To: sjeik_ap...@hotmail.com > CC: tutor@python.org > From: matt.ruff...@gmail.com > Date: Thu, 27 Aug 2015 12:41:45 -0400 > > On 2015-08-26 09:19, Albert-Jan Roskam wrote: >> For example, the category-min-max tuples >>

Re: [Tutor] value range checker

2015-08-28 Thread Albert-Jan Roskam
> To: tutor@python.org > From: alan.ga...@btinternet.com > Date: Wed, 26 Aug 2015 17:29:08 +0100 > Subject: Re: [Tutor] value range checker > > On 26/08/15 14:19, Albert-Jan Roskam wrote: > >> I have a written a function ch

Re: [Tutor] value range checker

2015-08-27 Thread Peter Otten
Albert-Jan Roskam wrote: > I have a written a function checks the validity of values. The ranges of > valid values are stored in a database table. > > Such a table contains three columns: category, min and max. One record of > such a table specifies the range for > > a certain category, but a ca

Re: [Tutor] value range checker

2015-08-26 Thread Alan Gauld
On 26/08/15 14:19, Albert-Jan Roskam wrote: I have a written a function checks the validity of values. > The ranges of valid values are stored in a database table. That's an unusual choice because: 1) using a database normally only makes sense in the case where you are already using the datab

[Tutor] value range checker

2015-08-26 Thread Albert-Jan Roskam
Hello, I have a written a function checks the validity of values. The ranges of valid values are stored in a database table. Such a table contains three columns: category, min and max. One record of such a table specifies the range for a certain category, but a category may be spread out over