Created
February 27, 2017 05:22
-
-
Save JelleZijlstra/852a60f0fb1acf2da24b48a4f496851c to your computer and use it in GitHub Desktop.
diff between py2 and 2and3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ diff stdlib/2/codecs.pyi stdlib/2and3/codecs.pyi | |
2c2 | |
< # https://docs.python.org/2/library/codecs.html | |
--- | |
> # https://docs.python.org/2/library/codecs.html and https://docs.python.org/3/library/codecs.html | |
9d8 | |
< Optional, | |
18c17 | |
< # str is the raw form and unicode is the cooked form. | |
--- | |
> # bytes (py2 str) is the raw form and str (py2 unicode) is the cooked form. | |
20,24c19,28 | |
< # There *are* str->str and unicode->unicode encodings in the standard library. | |
< # And unlike python 3, they are in fairly widespread use. | |
< | |
< _decoded = unicode | |
< _encoded = str | |
--- | |
> # There *are* bytes->bytes and str->str encodings in the standard library. | |
> # They are much more common in Python 2 than in Python 3. | |
> # Python 3.5 supposedly might change something there. | |
> | |
> if sys.version_info >= (3, 0): | |
> _decoded = str | |
> _encoded = bytes | |
> else: | |
> _decoded = unicode | |
> _encoded = str | |
44d47 | |
< def __init__(self, encode: _encode_type, decode: _decode_type, streamreader: _stream_reader_type = ..., streamwriter: _stream_writer_type = ..., incrementalencoder: _incremental_encoder_type = ..., incrementaldecoder: _incremental_decoder_type = ..., name: str = ...) -> None: ... | |
51a55 | |
> def __init__(self, encode: _encode_type, decode: _decode_type, streamreader: _stream_reader_type = ..., streamwriter: _stream_writer_type = ..., incrementalencoder: _incremental_encoder_type = ..., incrementaldecoder: _incremental_decoder_type = ..., name: str = ...) -> None: ... | |
72c76 | |
< def EncodedFile(file: BinaryIO, data_encoding: str, file_encoding: str = ..., errors: Optional[str] = ...) -> 'StreamRecoder': | |
--- | |
> def EncodedFile(file: BinaryIO, data_encoding: str, file_encoding: str = ..., errors: str = ...) -> 'StreamRecoder': | |
158c162 | |
< buffer = ... # type: str | |
--- | |
> buffer = ... # type: bytes | |
196c200 | |
< def __enter__(self) -> BinaryIO: | |
--- | |
> def __enter__(self) -> StreamReaderWriter: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment