
On Tue, Jan 15, 2013 at 11:31 AM, Steven D'Aprano <steve@pearwood.info> wrote:
All this assumes that we need to care about backward compatibility of ** in existing globs. It does seem to be an unlikely thing for people to write. If we don't, then no need for a flag at all. Instead, we could raise a warning for globs with ** in 3.4, and then drop the warning in 3.5.
Another option, is a new function. Bool parameters that do nothing but change the behaviour of a function are somewhat of a mild anti-pattern. Perhaps it is better to just keep glob.glob as is, and add glob.recglob or rglob to support **.
Making boolean parameters less awful from a readability perspective is part of the rationale for keyword-only arguments: they force you to include the parameter name, thus making the call self-documenting. In this case, the conservative backwards compatible migration path would be: In 3.4: - add the recursive globbing capability - add "allow_recursive=None" as a keyword-only argument - emit a DeprecationWarning if the double-star pattern is seen when allow_recursive is None (but not when it is explicitly False) In 3.5: - switch the allow_recursive default value to True - drop the deprecation warning Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia