You cannot override methods for built-in types, and you cannot change the default value of a parameter errorsto str.decode(). However, there are other ways to achieve the desired behavior.
: decode():
def decode(s, encoding="ascii", errors="ignore"):
return s.decode(encoding=encoding, errors=errors)
decode(s) s.decode(), , ?
: errors, , errors="strict" :
import codecs
def strict_handler(exception):
return u"", exception.end
codecs.register_error("strict", strict_handler)
errors="strict" "ignore". , , .
. - . ( , .)