-
Notifications
You must be signed in to change notification settings - Fork 62
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
Convenience: shorter code to build decor. #1903
Convenience: shorter code to build decor. #1903
Conversation
One nice task left is to go through the tutorials and correct all the line numbers :) |
I like! Ack to checking the line numbers for the generated docu. |
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.
This is why method chaining never took off in Python 😛 We should pick a format and stick with it though, so let's hash this out :) There's more occurences, but I just picked 2 archetypal ones to propose my solution.
I'll address that separatly, since there is more in the pipeline breaking them again. |
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.
-
The comments left on examples generalize to the other examples, so as soon as we agree, let's update them all.
-
Then also update line numbers in the tutorials.
Yes, I think, I'll add in another layer like this before we are done here (another PR) d = A.decor(paint=[('(all)', A.density('hh'), ...],
place=[('(location 0 0.5)', A.spike_detector(-40)), ...],
...) where you could pass anything iterable that yields tuples of locations and paintables/placeables. EDIT: Checked that out, result is discouraging. |
Again, the other convenience PR breaks numbers as well. Introducing |
@@ -0,0 +1,37 @@ | |||
#!/usr/bin/env python3 |
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.
Where is this file used?
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 hand it a .py in our tutorial style and it will hand you back a list of
.. literalinclude::
with the line numbers between # (N) Section
blocks.
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.
Good that you remind me: you can add that or at least one line up top stating what this file can do.
My question was though where it is used. Or is it meant as a helper wrt the tutorial/notebook situation later on?
Add method chaining to
decor::{place, paint, set_default}
, so that we can now writeto save some redundant typing. Adds the same to Python. Also modernise Python examples
where obvious.
Related to: #1862