Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
Thanks Chris On Tue, Apr 13, 2010 at 1:08 PM, Chris Rebert wrote: > > On Tue, Apr 13, 2010 at 12:29 PM, Chris Rebert > wrote: > >> On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana > wrote: > >> > Hi, > >> > > >> > I need to construct an if statement from the data coming from the > client > >> > as

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Chris Rebert
> On Tue, Apr 13, 2010 at 12:29 PM, Chris Rebert wrote: >> On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana wrote: >> > Hi, >> > >> > I need to construct an if statement from the data coming from the client >> > as >> > below: >> > >> > conditions: condition1, condition2, condition3, condition4 logic

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
They are bitwise operators! -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Chris Rebert
On Tue, Apr 13, 2010 at 8:56 AM, Vishal Rana wrote: > Hi, > > I need to construct an if statement from the data coming from the client as > below: > > conditions: condition1, condition2, condition3, condition4 logical > operators: lo1, lo2, lo3 (Possible values: "and" "or") > > Eg. > > if conditio

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
They are bitwise operators! Thanks Vishal Rana -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
They are bitwise operators! Thanks Vishal Rana -- http://mail.python.org/mailman/listinfo/python-list

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Terry Reedy
On 4/13/2010 11:56 AM, Vishal Rana wrote: Hi, I need to construct an if statement from the data coming from the client as below: conditions: condition1, condition2, condition3, condition4 logical operators: lo1, lo2, lo3 (Possible values: "and" "or") Eg. |if condition1 lo1 condition2 lo3 con

Re: Constructing an if statement from the client data in python

2010-04-13 Thread Benjamin Kaplan
All the operators are available as functions in the operator module. Just use a dict to select the correct function. import operator ops = {"and": operator.and_, "or": operator.or_} op1 = ops[lo1] op3 = ops[lo3] if op3( op1( condition1, condition2), condition4) : #do something On Tue, A

Constructing an if statement from the client data in python

2010-04-13 Thread Vishal Rana
Hi, I need to construct an if statement from the data coming from the client as below: conditions: condition1, condition2, condition3, condition4 logical operators: lo1, lo2, lo3 (Possible values: "and" "or") Eg. if condition1 lo1 condition2 lo3 condition4: # Do something I can think of ev