|
|
|
|
|
by mezzode
2869 days ago
|
|
`if-else` for this will get messy quickly the more layers down you want to go. if a is not None and a.b is not None:
c = a.b.c
else:
c = None
vs c = a?.b?.c
The safe navigation operator is useful enough that beginners ought to be introduced to them anyway.
I will admit that adding `??` may be too much though, we could easily just use an `or` (although the PEP does have some justifications for adding it). |
|