-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[doc] Update documentaion on meta programming for #1374 #1389
[doc] Update documentaion on meta programming for #1374 #1389
Conversation
Co-authored-by: Yuanming Hu <[email protected]>
This reverts commit 0d3efb6.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! Thank you. Please fix the minor wording issues.
for i in ti.static(range(4)): | ||
print(i) | ||
|
||
# is equivalent to: | ||
print(0) | ||
print(1) | ||
print(2) | ||
print(3) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that we are mixing 2-space and 4-space identation... Maybe we should somehow enforce PEP8 for all the Python code in the doc? I don't have a clear idea how that can be done automatically :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know, e.g.:
.. code-block::
4tabs
vs
.. code-block::
2tabs
Is that possible to let ti format
take care of that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that possible to let
ti format
take care of that too?
We probably can, but I don't think that would be easy. We will need to write an rst
parster that extract the code, format using yapf
, and the put it back...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, my idea is: not only parse the code-block
, but parse the whole rst
, e.g.:
- This is a bad line
+ This is a bad line
- This is a bad line that is tooooooooooo long for yapf
+ This is a bad line that is tooooooooooo
+ long for yapf
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need a different tool. I don't think yapf can correctly handle rst
...
Co-authored-by: Yuanming Hu <[email protected]>
Co-authored-by: Yuanming Hu <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Thank you.
Related issue = update doc for #1374
[Click here for the format server]