A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2010-December/106627.html below:

[Python-Dev] transform() and untransform() methods, and the codec registry

[Python-Dev] transform() and untransform() methods, and the codec registry [Python-Dev] transform() and untransform() methods, and the codec registryAlexander Belopolsky alexander.belopolsky at gmail.com
Thu Dec 9 19:55:08 CET 2010
On Thu, Dec 9, 2010 at 1:42 PM, Guido van Rossum <guido at python.org> wrote:
..
> string-string transforms use the same namespace even though the
> typical transform only supports one or the other. E.g. IMO all of the
> following should raise LookupError:
>
>>>> b'abc'.transform('rot13')
> Traceback (most recent call last):
> ..
>    return (input.translate(rot13_map), len(input))
> TypeError: expected an object with the buffer interface

This is actually *very* misleading because

>>> 'abc'.transform('rot13')
'nop'

works even though 'abc' is not "an object with the buffer interface".


>>> memoryview('abc')
Traceback (most recent call last):
  ..
TypeError: cannot make memory view because object does not have the
buffer interface
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4