Tim Golden wrote:
I was pondering on this yesterday, and the only case I've come across in my code -- and it's reasonably common -- is checking that one and only one of two params has been passed. I have code which wants, say, an id or a name but doesn't want both. It's hardly difficult to write the check even now, but an built-in xor would make it fractionally cleaner.
I think I would just have one parameter id_name or identifier so no check is needed. This is a common idiom in Python where names are not typed. Example: param 'source' is a string (with a file name to be opened) or an already opened file. If you want two local vars inside the function, that should be kept private to the function.
tjr -- http://mail.python.org/mailman/listinfo/python-list