On Wed, 18 Feb 2015 21:44:12 -0700, Jason Friedman wrote: > My question is, what would be a reasonable behavior/result/return value > if:
> 1. "/path/to/dir" does not exist or is not readable Normally I'd say raise an exception. Whether you choose to use an existing exception (will trying to read a non existent dir raise one anyway?) or define your own is up to you. This condition would probably indicate an error in the data received by the function - you should be given a readable directory. If (and only if) being called with an invalid directory is potentially valid, then you could respond to (1) the same as to (2). > 2. no files match the given pattern Return either None, 0, False or an empty string. In both cases, it is then a matter for the calling code to catch the exception or handle the return value appropriately. -- Denis McMahon, denismfmcma...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list