Skip to content
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

Remove json_util.py since it's currently unneeded #62

Closed
Solomon1732 opened this issue Feb 18, 2021 · 4 comments · Fixed by #66
Closed

Remove json_util.py since it's currently unneeded #62

Solomon1732 opened this issue Feb 18, 2021 · 4 comments · Fixed by #66
Assignees
Labels
enhancement New feature or request

Comments

@Solomon1732
Copy link
Contributor

Solomon1732 commented Feb 18, 2021

def _scan_iterable(obj, context=None):

As it stands, this function unites a number of disparate functionalities. Not only that, but the functionalities depend on the type of the first parameter object. It might be possible for it to benefit from breaking it up via @functools.singledispatch. The single dispatch decorator operates on the first parameter's type, which looks to me to be what the function in question does.

The flip side is that I'm not sure about the performance costs of doing such a thing. Having a new branch can be a cheap way to test it, since a branch can always be ignored/deleted later on.

Even if single dispatch turns out to not be worth it, I still think that, for code maintenance, the function might benefit from breaking it up into sub-functions (which are then called from the "head" function).

Edit: If such a move will be deemed as beneficial I don't mind making a PR for it.

@Solomon1732 Solomon1732 changed the title Possibly use functools' single dispatch to break up a function into subfunctions Possibly break up a function into subfunctions Feb 18, 2021
@devos50
Copy link
Contributor

devos50 commented Feb 18, 2021

Thanks for your suggestion! I'm not even sure if we want to keep that json_util file since it was mostly for Python 3 compatibility (when we migrated from Python 2).

@devos50 devos50 added the enhancement New feature or request label Feb 18, 2021
@devos50
Copy link
Contributor

devos50 commented Feb 23, 2021

@Solomon1732 given the discussion in the Tribler repository, could you try to remove this file? 😃

@Solomon1732
Copy link
Contributor Author

Will be happy to! 😃

@devos50
Copy link
Contributor

devos50 commented Feb 23, 2021

Thank you!

@Solomon1732 Solomon1732 changed the title Possibly break up a function into subfunctions Remove json_util.py since it's currently unneeded Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants