Hi all,

Returning to python after a brief affair with C++, I have the following code ...

                if (items.has_keys('snapshot_interval')):
                    self.snap_init[i] = items['snapshot_interval']
                else:
                    self.snap_init[i] = 0

I thought Python had a shorthand version of something like ....

                self.snap_init[i] =
(items.has_keys('snapshot_interval'))?items['snapshot_interval']:0

Googled but no luck ... or is it my poor overloaded brain getting confused ?

Cheers

Dave













-- 

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to