Re: [BangPypers] date range

2010-04-14 Thread Yuvi Panda
VB10 doesn't. Atleast not by default - they have keywords called AndAlso and OrElse for short circuiting Logical operators. On Thu, Feb 25, 2010 at 9:47 AM, Srinivas Reddy Thatiparthy srinivas_thatipar...@akebonosoft.com wrote: This is because AND operator short-circuits. So when 1 foo() is

Re: [BangPypers] date range

2010-02-24 Thread Vinay Shastry
On 10 February 2010 09:37, Srinivas Reddy Thatiparthy srinivas_thatipar...@akebonosoft.com wrote: It's called TWICE  , no matter with or without side effects. I asked this on SO,somebody came up with this answer! def check():        print 'Called Once'        return 2 1check()3 Called

Re: [BangPypers] date range

2010-02-24 Thread Shashwat Anand
It can be called just once too... def foo(): ... print called ... return 0 ... 1 foo() and foo() 3 called False This is because AND operator short-circuits. So when 1 foo() is false, it terminates then and there. Srinivas is correct here. ~l0nwlf

Re: [BangPypers] date range

2010-02-24 Thread Vinay Shastry
On 25 February 2010 09:21, Shashwat Anand anand.shash...@gmail.com wrote: It can be called just once too... def foo(): ...   print called ...   return 0 ... 1 foo() and foo() 3 called False This is because AND operator short-circuits. So when 1 foo() is false, it terminates then

Re: [BangPypers] date range

2010-02-24 Thread Srinivas Reddy Thatiparthy
Subject: Re: [BangPypers] date range On 25 February 2010 09:21, Shashwat Anand anand.shash...@gmail.com wrote: It can be called just once too... def foo(): ...   print called ...   return 0 ... 1 foo() and foo() 3 called False This is because AND operator short-circuits. So when 1

[BangPypers] date range

2010-02-09 Thread Kenneth Gonsalves
hi, any easy way of finding out whether a given date is between two other dates? -- regards Kenneth Gonsalves Senior Project Officer NRC-FOSS http://nrcfosshelpline.in/web/ ___ BangPypers mailing list BangPypers@python.org

Re: [BangPypers] date range

2010-02-09 Thread Rory Hart
It is nice and easy thankfully. datetime.date and datetime.datetime both support operators So: if startdate date and date enddate: print date in range http://docs.python.org/library/datetime.html On Tue, Feb 9, 2010 at 9:22 PM, Kenneth Gonsalves law...@au-kbc.org wrote: hi, any

Re: [BangPypers] date range

2010-02-09 Thread Kenneth Gonsalves
On Tuesday 09 Feb 2010 4:18:02 pm Rory Hart wrote: if startdate date and date enddate: print date in range that is what I was doing - too verbose, wanted to know if I could use 'in'. -- regards Kenneth Gonsalves Senior Project Officer NRC-FOSS http://nrcfosshelpline.in/web/

Re: [BangPypers] date range

2010-02-09 Thread Srinivas Reddy Thatiparthy
more compact is_in_range startdate date enddate I am very much interested to know how the above expression is evaluated in compiler? If the compiler evaluates left to right ,startdatedate becomes True or false depending on the values and Now, my question is how this (True/Flase enddate)

Re: [BangPypers] date range

2010-02-09 Thread Srinivas Reddy Thatiparthy
Formally, if a, b, c, ..., y, z are expressions and op1, op2, ..., opN are comparison operators, then a op1 b op2 c ... y opN z is equivalent to a op1 b and b op2 c and ... y opN z, except that each expression is evaluated at most once. Ok..Got it... Especially last sentence caught my

Re: [BangPypers] date range

2010-02-09 Thread Noufal Ibrahim
On Tue, Feb 9, 2010 at 5:07 PM, Srinivas Reddy Thatiparthy srinivas_thatipar...@akebonosoft.com wrote: Formally, if a, b, c, ..., y, z  are expressions and op1, op2, ..., opN are comparison operators, then a op1 b  op2 c ... y opN  z is equivalent to a op1 b and  b op2 c and ...  y opN z,

Re: [BangPypers] date range

2010-02-09 Thread Srinivas Reddy Thatiparthy
a b c is equivalent to a b and b c *except that* b is evaluated only once. Do mean to say that evaluating b only once applies to abc expression only. NOT for expressions like ab and bc. Regards, ~ Srini T Roshan ___ BangPypers

Re: [BangPypers] date range

2010-02-09 Thread Srinivas Reddy Thatiparthy
a b c is equivalent to a b and b c *except that* b is evaluated only once. correction Did u mean to say that evaluating b only once applies to abc expression only,NOT for expressions like ab and bc.? /correction Regards, ~ Srini T

Re: [BangPypers] date range

2010-02-09 Thread Roshan Mathews
On Tue, Feb 9, 2010 at 17:53, Srinivas Reddy Thatiparthy srinivas_thatipar...@akebonosoft.com wrote: a b c   is equivalent to   a b and b c   *except that* b is evaluated only once. correction Did u  mean to say that evaluating b only once applies to  abc expression only,NOT for