Terry Reedy writes: > On 9/16/2013 4:14 PM, R. David Murray wrote: > > > Well, we tend to avoid single boolean arguments in favor of differently > > named functions. > > The stdlib has lots of boolean arguments. My impression is that they are > to be avoided when they would change the return type or otherwise do > something disjointly different. I do not think this would apply here.
I remember reading that the criterion is whether the argument is most often given a literal value. Then "stat_cache()" is preferable to "stat(cache=True)". OTOH, "stat(cache=want_cache)" is better than if want_cache: result = stat_cache() else: result = stat() or "result = stat_cache() if want_cache else stat()". _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com