gramps-devel

 [Gramps-devel] Help! From: Peter Landgren - 2009-02-03 15:23:13 Attachments: Message as HTML Hi, I'm either tired or cant's se what's wrong with: latitude, longitude = self._lat_lon(place) if (latitude > 54.55 and latitude < 69.05) and (longitude > 8.05 and longitude < 24.15): coord_ok = True print coord_ok, latitude, longitude else: print "else",coord_ok, latitude, longitude with latitude = 58.1 and longitude = 12.9 I get as result else False 58.1 12.9 I'm testing to see if 54.55 < latitude < 69.05 and 8.05 < longitude < 24.15 But I alwys get false /Peter
 Re: [Gramps-devel] Help! From: Benny Malengier - 2009-02-03 15:30:28 Attachments: Message as HTML What you say cannot be correct: benny@...:~/gramps/trunk\$ python Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22) [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> def f(a,b): ... if (a > 54.55 and a < 69.05) and (b > 8.05 and b < 24.15): ... print True,a,b ... else: ... print False,a,b ... >>> f(58.1 , 12.9) True 58.1 12.9 Note that you should check if you do not get None, None as return value, but anyway, the python code that actually fails would be needed to know what is going on. Benny 2009/2/3 Peter Landgren > Hi, > > I'm either tired or cant's se what's wrong with: > > latitude, longitude = self._lat_lon(place) > > if (latitude > 54.55 and latitude < 69.05) and (longitude > 8.05 and > longitude < 24.15): > > coord_ok = True > > print coord_ok, latitude, longitude > > else: > > print "else",coord_ok, latitude, longitude > > with > > latitude = 58.1 and longitude = 12.9 > > I get as result > > else False 58.1 12.9 > > I'm testing to see if > > 54.55 < latitude < 69.05 and 8.05 < longitude < 24.15 > > But I alwys get false > > /Peter > > > > ------------------------------------------------------------------------------ > Create and Deploy Rich Internet Apps outside the browser with > Adobe(R)AIR(TM) > software. With Adobe AIR, Ajax developers can use existing skills and code > to > build responsive, highly engaging applications that combine the power of > local > resources and data with the reach of the web. Download the Adobe AIR SDK > and > Ajax docs to start building applications today- > http://p.sf.net/sfu/adobe-com > _______________________________________________ > Gramps-devel mailing list > Gramps-devel@... > https://lists.sourceforge.net/lists/listinfo/gramps-devel > >
 Re: [Gramps-devel] Help! From: Peter Landgren - 2009-02-03 15:51:24 Attachments: Message as HTML Well, The problem was that I compared strings with float! After I converted latitude and longitude to float it worked! /Peter > What you say cannot be correct: > > benny@...:~/gramps/trunk\$ python > Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22) > [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > > >>> def f(a,b): > > ... if (a > 54.55 and a < 69.05) and (b > 8.05 and b < 24.15): > ... print True,a,b > ... else: > ... print False,a,b > ... > > >>> f(58.1 , 12.9) > > True 58.1 12.9 > > Note that you should check if you do not get None, None as return value, > but anyway, the python code that actually fails would be needed to know > what is going on. > > Benny > > 2009/2/3 Peter Landgren > > > Hi, > > > > I'm either tired or cant's se what's wrong with: > > > > latitude, longitude = self._lat_lon(place) > > > > if (latitude > 54.55 and latitude < 69.05) and (longitude > 8.05 and > > longitude < 24.15): > > > > coord_ok = True > > > > print coord_ok, latitude, longitude > > > > else: > > > > print "else",coord_ok, latitude, longitude > > > > with > > > > latitude = 58.1 and longitude = 12.9 > > > > I get as result > > > > else False 58.1 12.9 > > > > I'm testing to see if > > > > 54.55 < latitude < 69.05 and 8.05 < longitude < 24.15 > > > > But I alwys get false > > > > /Peter > > > > > > > > ------------------------------------------------------------------------- > >----- Create and Deploy Rich Internet Apps outside the browser with > > Adobe(R)AIR(TM) > > software. With Adobe AIR, Ajax developers can use existing skills and > > code to > > build responsive, highly engaging applications that combine the power of > > local > > resources and data with the reach of the web. Download the Adobe AIR SDK > > and > > Ajax docs to start building applications today- > > http://p.sf.net/sfu/adobe-com > > _______________________________________________ > > Gramps-devel mailing list > > Gramps-devel@... > > https://lists.sourceforge.net/lists/listinfo/gramps-devel -- Peter Landgren Talken Hagen 671 94 BRUNSKOG 0570-530 21 070-635 4719 peter.talken@... Skype: pgl4820.2