Skip to content

Bare Union, Callable and Tuple should not be classes #133

Closed

Description

@gvanrossum

There is no reason for "bare" Union, Callable or Tuple (i.e. without [...]) to be a class. You shouldn't ever write isinstance(x, Union) for example, and in their bare form these are not acceptable as annotations either.

Activity

  1. self-assigned this
    on May 21, 2015
  2. agronholm commented on May 26, 2015

    @agronholm
    Contributor

    I've been using Callable like that. What's wrong with doing so? Should I import Callable from collections.abc then? Or always use Callable[..., Any]?

  3. gvanrossum commented on May 26, 2015

    @gvanrossum
    MemberAuthor

    Hm, that's a good point. Pretty much anything you can do with collections.abc.X should be possible with typing.X. (This does not apply to things that aren't defined in collection.abc though, so this is not the case for Union, Tuple or List etc.)

  4. added a commit that references this issue on Sep 27, 2016
    7baf6fe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions