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

fix some abstract classes in Python 2 #2240

Merged
merged 1 commit into from
Jun 16, 2018

Conversation

JelleZijlstra
Copy link
Member

Part of #1476.

This fixes about half of the issues in the 2.7 stubs.

@@ -1,12 +1,15 @@
# Stubs for cStringIO (Python 2.7)
# See https://docs.python.org/2/library/stringio.html

from abc import ABCMeta
from typing import overload, IO, List, Iterable, Iterator, Optional, Union
from types import TracebackType

# TODO the typing.IO[] generics should be split into input and output.
Copy link
Member

@ilevkivskyi ilevkivskyi Jun 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a good idea. Some other languages have Reader and Writer classes. We can have structure like this:

class Reader(Generic[AnyStr]):
    # basic read methods
class Writer(Generic[AnyStr]):
    # basic write methods
class IO(Reader[AnyStr], Writer[AnyStr]):
    # some additional rarely used methods

Do we have an issue to track this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so, feel free to open one. I'm a bit hesitant to fiddle with the IO class hierarchy though.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, opened python/typing#564

@ilevkivskyi ilevkivskyi merged commit 0393de4 into python:master Jun 16, 2018
@JelleZijlstra JelleZijlstra deleted the abstract27 branch June 16, 2018 23:58
yedpodtrzitko pushed a commit to yedpodtrzitko/typeshed that referenced this pull request Jan 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants