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

Various things in stdlib could benefit from the plugin system #3541

Closed
JukkaL opened this issue Jun 14, 2017 · 6 comments
Closed

Various things in stdlib could benefit from the plugin system #3541

JukkaL opened this issue Jun 14, 2017 · 6 comments
Labels
feature priority-1-normal topic-plugins The plugin API and ideas for new plugins

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Jun 14, 2017

These ideas are from #1240:

  • re.findall
  • sys.exc_info
  • The built-in function pow (not math.pow)
  • universal_newlines and subprocess.Popen
  • dict(key=value) and dict.update with keyword arguments (the prior is currently special cased without a plugin)
  • sum (works for anything that supports +)
  • Parts of itertools and functools
  • struct (could infer type from format string)
@JukkaL JukkaL added feature priority-1-normal topic-plugins The plugin API and ideas for new plugins labels Jun 14, 2017
@ilevkivskyi
Copy link
Member

sum (works for anything that supports +)

I would rather try supporting this by adding a protocol like Addable, (maybe also Comparable for sorted in Python 3). If that will not work, then this can be done using a plugin, but Addable and Comparable may be useful on their own.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jun 14, 2017

Addable and Comparable may be hard to support in full generality. The complex semantics of reverse operator methods such as __add__ vs. __radd__ are one factor. When I looked at this earlier I came up with some tricky-looking corner cases but I can't remember all the details any more.

@ilevkivskyi
Copy link
Member

I would add better support for enum to the list, see for example #3546
Or are we going to continue special casing Enum directly in code?

@JukkaL
Copy link
Collaborator Author

JukkaL commented Jun 15, 2017

It's not a priority to get rid of the existing special casing for enum, but it would be better to use the plugin system for new features whenever possible. In the long term it may make sense to use a plugin for all or most of enum functionality.

@ilevkivskyi
Copy link
Member

Here is an example where plugin for itertools.product will be useful: #3884

@hauntsaninja
Copy link
Collaborator

Closing because stale / protocols and literals. #7803 would be useful though!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature priority-1-normal topic-plugins The plugin API and ideas for new plugins
Projects
None yet
Development

No branches or pull requests

3 participants