None
provided as default PTC-W0039None
as default value is redundant197
198 # No need to specify scheme-corresponding port
199 port = url.port
200 if port and url.scheme == SCHEMES.get(url.port, None):201 port = None
202
203 return '{scheme}://{hostname}:{port}{file_relative_path}'.format(
It is unnecessary to provide None
as the default value when the key is not present in the dictionary as get
implicitly returns None
.
Not preferred:
value = some_dict.get("key", None)
Preferred:
value = some_dict.get("key")