yelite commented on code in PR #12048:
URL: https://github.com/apache/tvm/pull/12048#discussion_r924055842
##########
python/tvm/script/printer/doc.py:
##########
@@ -29,12 +34,63 @@ class Doc(Object):
class ExprDoc(Object):
"""Base class of all expression Docs"""
+ def attr_access(self, attr: str) -> "AttrAccessDoc":
Review Comment:
This is a tricky one. If strictly following C++ APIs and Python name
convention, we will have
```python
doc.attr # helper method to create AttrAccessDoc
doc.attr # AttrAccessDoc's `attr` attribute, that's a name conflict
doc.index # helper method to create IndexDoc
doc.indices # attribute of IndexDoc, looks similar to the method above
```
An option is to update the C++ API to `AttrAccess` and `IndexAccess`, which
makes the code slightly more verbose
```cpp
TIR(p)->Attr("cast")
// becomes
TIR(p)->AttrAccess("cast")
```
What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]