Skip to content

fix some abstract classes in Python 2 - #2240

Merged
ilevkivskyi merged 1 commit into
python:masterfrom
JelleZijlstra:abstract27
Jun 16, 2018
Merged

ilevkivskyi merged 1 commit into
python:masterfrom
JelleZijlstra:abstract27

Conversation

@JelleZijlstra

Copy link
Copy Markdown
Member

Part of #1476.

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

Comment thread stdlib/2/cStringIO.pyi
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.

@ilevkivskyi ilevkivskyi Jun 16, 2018 •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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