[Python-ideas] PEP 505 (None coalescing operators) thoughts
Emile van Sebille
emile at fenx.com
Tue Sep 29 18:58:40 CEST 2015
On 9/29/2015 9:20 AM, Rob Cliffe wrote:
> Why not
>
> def __init__(self, vertices=None, edges=None, weights=None,
> source_nodes=None):
> self.vertices = vertices if vertices is not None else []
> self.edges = edges if edges is not None else []
> self.weights = weights if weights is not None else {}
> self.source_nodes = source_nodes if source_nodes is not None else []
I don't understand why not:
self.vertices = vertices or []
self.edges = edges or []
self.weights = weights or {}
self.source_nodes = source_nodes or []
Emile
More information about the Python-ideas
mailing list