Am 08.02.2013 07:29 schrieb Rick Johnson:

Consider this:

     if connect("my:db") as db:
         <do something>

No need to make a call and then test for the validity of the call when you can 
do both simultaneously AND intuitively.

Would be great, but can be emulated with

def ifiter(x):
    if x: yield x

for db in ifiter(connect("my:db")):
    <do sth with db>

Is not very intuitive, however, but does its job.


Thomas

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to