Matt C. Wilson created TINKERPOP-3119:
-----------------------------------------
Summary: Have the gremlin_python Vertex class support key-value
access of individual properties
Key: TINKERPOP-3119
URL: https://issues.apache.org/jira/browse/TINKERPOP-3119
Project: TinkerPop
Issue Type: Bug
Components: python
Affects Versions: 3.7.3
Reporter: Matt C. Wilson
The gremlin_python `Element` class (and thus all Graph object subclasses) has a
`properties` property that must be iterated and each member inspected to find a
particular property by name.
[https://github.com/apache/tinkerpop/blob/8aad0bc72a1d11791ddbd5070962caa23223bf3d/gremlin-python/src/main/python/gremlin_python/structure/graph.py#L29-L39|https://github.com/apache/tinkerpop/blob/master/gremlin-python/src/main/python/gremlin_python/structure/graph.py]
Example:
```
for vp in vertex.properties:
if vp.key == key:
logging.debug(f"\{vertex}.properties['\{key}']: \{vp.value}")
return vp.value
```
It would be nice to be able to do:
```
p = vertex.properties
return vertex[key] if p and p.hasattr(key) else None
```
--
This message was sent by Atlassian Jira
(v8.20.10#820010)