use 'functools.partial' in '_build_cleanfunc' when possible
makes calls to the returned function a slight bit faster (~10%)
This commit is contained in:
@@ -851,8 +851,8 @@ class PathFormat():
|
||||
def func(x, c=chars, r=repl):
|
||||
return x.replace(c, r)
|
||||
else:
|
||||
def func(x, sub=re.compile("[" + chars + "]").sub, r=repl):
|
||||
return sub(r, x)
|
||||
return functools.partial(
|
||||
re.compile("[" + chars + "]").sub, repl)
|
||||
return func
|
||||
|
||||
def open(self, mode="wb"):
|
||||
|
||||
Reference in New Issue
Block a user