Skip to content

Commit c57620e

Browse files
committed
improve README phrasing
1 parent 375ab0d commit c57620e

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2138,9 +2138,15 @@ session.acls.apply_atomic_operations(
21382138
)
21392139
```
21402140
`ACLOperation` objects form a linear order with `iRODSAccess` objects, and
2141-
indeed are subclassed from them as well, allowing intermixed sequences to be
2142-
sorted. Care should be taken to normalize the objects before such comparisons,
2143-
sorting, or with related uses of the 'in' operator.
2141+
indeed are subclassed from them as well, allowing equivalence comparisons and
2142+
also permitting intermixed sequences to be sorted (using the `__lt__` method
2143+
if no sort `key` parameter is given).
2144+
2145+
Care should be taken however to normalize the objects before such comparisons
2146+
and sorting, and with connected uses of the `in` operator (which leverages `__eq__`).
2147+
2148+
The following code sorts the objects based on their lexical order starting with the
2149+
normalized `access_name`, which serves to group identical permissions together:
21442150
```py
21452151
from irods.access import *
21462152
normalize = lambda acl: acl.copy(decanonicalize=-1, implied_zone='tempZone')
@@ -2156,7 +2162,7 @@ print(normalize(acls[0]) == normalize(acls[1]))
21562162
print(normalize(iRODSAccess('read', '/tempZone/home/alice', 'bob')) in map(normalize, acls))
21572163
```
21582164

2159-
If strict order of permissions is desired, use something like the below:
2165+
If strict order of permissions is desired, we can use code such as the following:
21602166
```py
21612167
from irods.access import *
21622168
from pprint import pp

0 commit comments

Comments
 (0)