I have: ======================================================================== accepted_params = { 'pcpu', 'rss', 'size', 'time', 'vsize', } ========================================================================
Later I use: ======================================================================== if (to_check != 'all') and not(to_check in accepted_params): raise Exception('Used illegal parameter: {0}.\n' 'Accepted ones: {1}' .format(to_check, sorted(accepted_params))) ======================================================================== When using 'all' I want to do the work for all accepted parameters. ;-) Is this a correct way to do this, or is there a better way? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list