"Randall Parker" <[EMAIL PROTECTED]> writes:
> if OperatorType == ">":
>    # then do a greater than compare here.
>    BoolVal = TestVal > TargetVal
> elif OperatorType == ">=":
>    # then do a greater or equal to here.
>    BoolVal = TestVal >= TargetVal
>  and so on.
>
> It would seem a lot easier to do:
>
>     BoolVal  = TargetVal EvalStrToOper(">") MyInnerList(2)
>
>  where EvalStrToOper creates an immediate > sign that then allows that
> line to get evaluated by the interpreter.


How about:

    BoolVal = EvalStrToOper[">"](TargetVal, MyInnerList(2)) ?

EvalStrOper = {'>': operator.gt, '>=': operator.ge,
               '<': operator.lt, '<=': operator.le,
               ...

        <mike
-- 
Mike Meyer <[EMAIL PROTECTED]>                  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to