mahmoud / glom

☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️
https://glom.readthedocs.io
Other
1.89k stars 61 forks source link

added null coalesce operator to path #143

Open kurtbrose opened 4 years ago

codecov[bot] commented 4 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@0531ca2). Click here to learn what that means. The diff coverage is 96.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #143   +/-   ##
=========================================
  Coverage          ?   97.27%           
=========================================
  Files             ?       22           
  Lines             ?     2904           
  Branches          ?      415           
=========================================
  Hits              ?     2825           
  Misses            ?       50           
  Partials          ?       29           
Impacted Files Coverage Δ
glom/core.py 97.40% <92.85%> (ø)
glom/test/test_path_and_t.py 99.21% <100.00%> (ø)
glom/chainmap_backport.py 69.87% <0.00%> (ø)
glom/__main__.py 33.33% <0.00%> (ø)
glom/test/test_basic.py 100.00% <0.00%> (ø)
glom/mutation.py 98.75% <0.00%> (ø)
glom/test/test_reduction.py 100.00% <0.00%> (ø)
glom/test/test_mutation.py 97.94% <0.00%> (ø)
glom/tutorial.py 100.00% <0.00%> (ø)
glom/test/test_streaming.py 100.00% <0.00%> (ø)
... and 14 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 0531ca2...92fba74. Read the comment docs.

mahmoud commented 4 years ago

Stopping by to note that Python's PEP 505 on this got deferred. To me that's notable. Glom has an easy way of getting a default out of a long line of attribute accesses (glom(target, 'a.b.c.d', default=None)). And maybe once in my entire programming career have I ever needed to "get strict again" (i.e., give me a None if b isn't present, but raise an error if there's a b but no c). To me that feels like pattern matching lite (or microlite), and we already have Match coming in! So I think I want to defer this, and leave the Path simple whenever possible. Hope this deferral makes sense to any and all reading this. If we end up having a clear cut use case, you know I'll happily revive it.