Re: [BangPypers] date range

2010-02-09 Thread Srinivas Reddy Thatiparthy
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 >>> 1>> 1>> Happy Hacking. Regards, ~ Srini T ___ BangPypers mailing li

Re: [BangPypers] Trouble installing psycopg2 in Snow Leopard

2010-02-09 Thread Diptanu Choudhury
I followed the instructions there. I get the following error now - Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/psycopg2/__init__.py", line 60, in from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID ImportError: dlopen(/

Re: [BangPypers] Trouble installing psycopg2 in Snow Leopard

2010-02-09 Thread Pradeep Gowda
On Tue, Feb 9, 2010 at 11:07 AM, Diptanu Choudhury wrote: > 2): Symbol not found: _PQbackendPID Looks like a 32/64 bit related mixup. See:http://stubblog.wordpress.com/2009/06/07/installing-psycopg2-on-osx/ Report back if you had any success. ___ Bang

Re: [BangPypers] date range

2010-02-09 Thread Roshan Mathews
On Tue, Feb 9, 2010 at 17:53, Srinivas Reddy Thatiparthy wrote: > >>>a < b < c   is equivalent to   a < b and b < c   *except that* b is > evaluated only once. > > > > Did u  mean to say that evaluating b only once applies to  a expression only,NOT for expressions like   a > Assuming you're talk

[BangPypers] Trouble installing psycopg2 in Snow Leopard

2010-02-09 Thread Diptanu Choudhury
Hi All, I am trying to use the psycopg2 library to connect to Postgres database. However, on importing psycopg2, I get the following error. Traceback (most recent call last): File "", line 1, in File "/Library/Python/2.6/site-packages/psycopg2/__init__.py", line 60, in from psycopg2._ps

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. Did u mean to say that evaluating b only once applies to a Regards, ~ Srini T ___ BangPypers mailing list BangPypers@python.org http://mail.python.org/m

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 ahttp://mail.python.org/mailman/listinfo/bangpypers ___ BangPypers mailing list BangPypers@python.org http

Re: [BangPypers] date range

2010-02-09 Thread Roshan Mathews
On Tue, Feb 9, 2010 at 17:07, Srinivas Reddy Thatiparthy wrote: > Ok..Got it... > Especially last sentence caught my eye.. > Does the python compiler behaves same for below expression also? > > 1.If(a > My guess  is, it behaves the same but just wanna double check.. > You want to know if "b" is ev

Re: [BangPypers] date range

2010-02-09 Thread Noufal Ibrahim
On Tue, Feb 9, 2010 at 5:07 PM, Srinivas Reddy Thatiparthy 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, except that each > expression is eva

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 ey

Re: [BangPypers] date range

2010-02-09 Thread Kenneth Gonsalves
On Tuesday 09 Feb 2010 4:47:08 pm Shekhar wrote: > > On Tuesday 09 Feb 2010 4:18:02 pm Rory Hart wrote: > > > > > >> if startdate < date and date < enddate: > >> > >> print "date in range" > >> > >> > > more compact > is_in_range = startdate < date < enddate > if stardate<=date<=endd

Re: [BangPypers] date range

2010-02-09 Thread Roshan Mathews
On Tue, Feb 9, 2010 at 16:51, Srinivas Reddy Thatiparthy wrote: > >>>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  ,startdate false depending on the values

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 ,startdatehttp://mail.python.org/mailman/listinfo/bangpypers

Re: [BangPypers] date range

2010-02-09 Thread Shekhar
Kenneth Gonsalves wrote: On Tuesday 09 Feb 2010 4:18:02 pm Rory Hart wrote: if startdate < date and date < enddate: print "date in range" more compact is_in_range = startdate < date < enddate that is what I was doing - too verbose, wanted to know if I could use 'in'. _

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 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 wrote: > hi, > > any easy way

[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 http://mail.python.org/mailman

Re: [BangPypers] which one is the best pythonic way .

2010-02-09 Thread Anand Balachandran Pillai
On Tue, Feb 9, 2010 at 1:11 PM, Dhananjay Nene wrote: > On Tue, Feb 9, 2010 at 1:03 PM, Dhananjay Nene >wrote: > > > > > > > Interestingly in my computations the second approach (zip) is about 35% > > slower (as measured over 5 runs of 1M iterations each) than the first one > > (map/lambda). I b