| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM in general.
Only needed to document this change:
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
|
I have made the requested changes; please review again. |
Sorry, something went wrong.
|
Thanks for making the requested changes! @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for working on this! Mostly LGTM. I've left a few comments.
Sorry, something went wrong.
There was a problem hiding this comment.
FWIW, code is almost always more readable when limited to one action per line. Among other things, it makes it much easier to understand what's happening (especially when parentheses are involved).
| self.assertEqual(pprint.pformat(types.SimpleNamespace()), "namespace()") | |
| formatted = pprint.pformat( | |
| types.SimpleNamespace()) | |
| self.assertEqual(formatted, "namespace()") |
Personally I like to separate the 3 parts (setup, actual-thing-to-test, assertions) with blank lines, for further readability, but that's more personal preference:
| self.assertEqual(pprint.pformat(types.SimpleNamespace()), "namespace()") | |
| ns = types.SimpleNamespace() | |
| formatted = pprint.pformat(ns) | |
| self.assertEqual(formatted, "namespace()") |
Sorry, something went wrong.
There was a problem hiding this comment.
I do not think that adding an empty line after every line of code will make the code more readable. Empty lines should be used for separating logical sections of the code.
This code is consistent with the code in this file and looks clear to me. I do not think that any changes are needed.
Sorry, something went wrong.
There was a problem hiding this comment.
I followed most of @ericsnowcurrently's suggestions, but without the empty lines and without textwrap.dedent to be consistent with the rest of the file and I think it has made the test more clear.
Sorry, something went wrong.
There was a problem hiding this comment.
As before, I recommend one action per line.
| self.assertEqual(pprint.pformat(n, width=60), """\ | |
| formatted = pprint.pformat(ns, width=60) | |
| self.assertEqual(formatted, """\ |
...and separating the key sections of the test.
| self.assertEqual(pprint.pformat(n, width=60), """\ | |
| formatted = pprint.pformat(ns, width=60) | |
| self.assertEqual(formatted, """\ |
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
I have made the requested changes; please review again. @serhiy-storchaka I ended up removing the write = stream.write optimization. If you do think it is worth it in this case, please let me know and I'll bring it back (properly this time, as pointed out by @ericsnowcurrently). |
Sorry, something went wrong.
|
Thanks for making the requested changes! @ericsnowcurrently, @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
Add a test for a SimpleNamespace subclass.
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
I have made the requested changes; please review again. @serhiy-storchaka ofc it was because of subclassing. Glad you're here to review! :D |
Sorry, something went wrong.
|
Thanks for making the requested changes! @ericsnowcurrently, @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thank you Carl. LGTM, just fix an indentation in docs.
Sorry, something went wrong.
There was a problem hiding this comment.
| Added support for pretty-printing :class:`types.SimpleNamespace`. | |
| Added support for pretty-printing :class:`types.SimpleNamespace`. |
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for working to resolve our various comments!
Other than one small thing, LGTM.
Sorry, something went wrong.
There was a problem hiding this comment.
If this check is for the sake of subclasses then I'd recommend being explicit about it:
| if cls_name == "SimpleNamespace": | |
| if type(object) is _types.SimpleNamespace: |
Sorry, something went wrong.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request. |
Sorry, something went wrong.
|
I have made the requested changes; please review again. @ericsnowcurrently I attempted to make it more clear what the class-name-if-statement is about. Thank you very much to the both of you for the fast, high quality responses. It was a good experience :-) |
Sorry, something went wrong.
|
Thanks for making the requested changes! @ericsnowcurrently, @serhiy-storchaka: please review the changes made to this pull request. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM. I'm approving this, but also leaving one last comment. :) (feel free to ignore)
Thanks again for doing this.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for updating this. It's more clear now (as a reader).
Sorry, something went wrong.
There was a problem hiding this comment.
And better. Checking the class by comparing the class name to a string is a bit wonky :D Thanks for pointing out, what I was actually doing.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks for adding a comment here. That helps. :) FWIW, the following might be more clear:
# The SimpleNamespace repr has "namespace" instead of the class name, so # we do the same here. For subclasses we just use the class name.
Sorry, something went wrong.
There was a problem hiding this comment.
Tried improving it, should be clear now
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
https://bugs.python.org/issue37376