Skip to content

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

Closed

Description

@JukkaL

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)

Activity

  1. ilevkivskyi commented on Jun 14, 2017

    @ilevkivskyi
    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.

  2. JukkaL commented on Jun 14, 2017

    @JukkaL
    CollaboratorAuthor

    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.

  3. ilevkivskyi commented on Jun 15, 2017

    @ilevkivskyi
    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?

  4. JukkaL commented on Jun 15, 2017

    @JukkaL
    CollaboratorAuthor

    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.

  5. ilevkivskyi commented on Aug 29, 2017

    @ilevkivskyi
    Member

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

  6. hauntsaninja commented on Oct 31, 2021

    @hauntsaninja
    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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions