preferring [] or () in list of error codes?

mh at mh at
Mon Jun 8 23:36:51 CEST 2009

Is there any reason to prefer one or the other of these statements?

        if e.message.code in [25401,25402,25408]:
        if e.message.code in (25401,25402,25408):

I'm currently using [], but only coz I think it's prettier
than ().

context: these are database errors and e is database exception,
so there's probably been zillions of instructions and io's
handling that already.

Many TIA!

Mark Harrison
Pixar Animation Studios

More information about the Python-list mailing list