How to default to CLoader in PyYaml.load
Is 开发者_如何学Gothere any way to have the default loader for PyYaml be CLoader. So instead of having to do
yaml.load(f, Loader=yaml.CLoader)
It would just default to CLoader, so I could do:
yaml.load(f)
I think what you are looking for is functools.partial:
import functools
myload=functools.partial(yaml.load,Loader=yaml.CLoader)
myload(f)
精彩评论