sentinel object trick, to avoid the tricky error of a mutable default argument
_default_skip_tags_sentinel = object()
_default_skip_tags = ['pre']
def elem_strip_all_text(
parent_e,
chars=" \r\n\t",
skip_tags=_default_skip_tags_sentinel,
grandparent_tag_hint=None,
):
...
if skip_tags is _default_skip_tags_sentinel:
skip_tags = _default_skip_tags
if skip_tags is None:
skip_tags = []
...
Join Now to Reply!
To add your own reply, sign in or join Pownce today!