Skip to content

Commit 69e3759

Browse files
committed
Add example usage
1 parent 0701a0b commit 69e3759

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

parcels/_compat.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,20 @@
1919
pass
2020

2121

22-
# for compat with v3 of parcels. Not sure if there's a better way to do this in v4...
22+
# for compat with v3 of parcels when users provide `initial=attrgetter("lon")` to a Variable
23+
# so that particle initial state matches another variable
2324
class _AttrgetterHelper:
25+
"""
26+
Example usage
27+
28+
>>> _attrgetter_helper = _AttrgetterHelper()
29+
>>> _attrgetter_helper.some_attribute
30+
'some_attribute'
31+
>>> from operator import attrgetter
32+
>>> attrgetter('some_attribute')(_attrgetter_helper)
33+
'some_attribute'
34+
"""
35+
2436
def __getattr__(self, name):
2537
return name
2638

0 commit comments

Comments
 (0)