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):
|
def func(x, c=chars, r=repl):
|
||||||
return x.replace(c, r)
|
return x.replace(c, r)
|
||||||
else:
|
else:
|
||||||
def func(x, sub=re.compile("[" + chars + "]").sub, r=repl):
|
return functools.partial(
|
||||||
return sub(r, x)
|
re.compile("[" + chars + "]").sub, repl)
|
||||||
return func
|
return func
|
||||||
|
|
||||||
def open(self, mode="wb"):
|
def open(self, mode="wb"):
|
||||||
|
|||||||
Reference in New Issue
Block a user