Check if a given value is out of certain range
Chris Angelico
rosuav at gmail.com
Mon Oct 5 09:10:00 EDT 2015
On Mon, Oct 5, 2015 at 10:42 PM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Why not use a fricking class framework:
>
> Then, we could simply have:
>
> if Range(IncludedEndpoint(0), IncludedEndpoint(10)).outside(x):
> print("x has wrong value")
> else:
> print("x has good value")
>
> Just for the sake of readability, I mean...
Hold on a moment! You can't seriously be contemplating instantiating
those classes directly, can you?!? You need to go through the
ThreadedRangeFactory, passing it a couple of EndpointFactory
subclasses to suggest which kinds of endpoints to employ, and finally
use operator overloading to wait for the factory thread to finish its
work. *THEN* you can use this Range object.
ChrisA
has just been reading http://thedailywtf.com/articles/eins-zwei-zuffa
More information about the Python-list
mailing list