Newbie Q: modifying SQL statements

Hrvoje Niksic hniksic at xemacs.org
Fri Jan 11 18:23:45 EST 2008


"Faber J. Fedor" <faber at linuxnj.com> writes:

> On 10/01/08 22:53 -0500, Mike Meyer wrote:
>> Personally, I think it would be more pythonic to not try and use two
>> different APIs to walk the list of jobs (... One Way To Do it):
>> 
>> def __call__(self, where=None):
>>     q = "select * from %s" % (self.name,) + ("" if not where else (" where %s" % where))
>
> Does this '("" if not where...' syntax actually work?

http://docs.python.org/whatsnew/pep-308.html



More information about the Python-list mailing list