[Tutor] using in over several entities

Tino Dai tinoloc at gmail.com
Fri Aug 24 17:00:51 CEST 2007


Hi there,

    I am wondering about a short cut to doing this. Let's say that we have
an array:

dbs= ['oracle','mysql','postgres','infomix','access']

and we wanted to do this:

if 'oracle' in dbs or 'mysql' in dbs or 'bdb' in dbs:
   <... do something ...>

Is there a short way or writing this? Something like
    ('oracle','mysql','bdb') in dbs

I do see that the the conjunction can be problematic, and I do see that can
write a short function to get this working. But before I do that, I wanted
to see that there was nothing in Python that already did that.

Thanks!
Tino
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070824/17b325f8/attachment.htm 


More information about the Tutor mailing list