[Python-Dev] PEP 246: lossless and stateless
Phillip J. Eby
pje at telecommunity.com
Fri Jan 14 16:22:36 CET 2005
At 09:47 AM 1/14/05 +0000, Armin Rigo wrote:
>For example, strings "mean" very
>different concepts in various contexts, e.g. a file name, an url, the byte
>content a document, or the pickled representation of something.
Note that this is solvable in practice by the author of a method or
framework choosing to define an interface that they accept, and then
pre-defining the adaptation from string to that interface. So, what a
string "means" in that context is pre-defined.
The interpretation problem for strings comes only when a third party
attempts to define adaptation from a string to a context that takes some
more generic interface.
>This would allow a module to provide the str->StringIO or str->file conversion
>locally.
It also works for the module to define a target interface and register an
adapter to that, and introduces less complexity into the adaptation system.
More information about the Python-Dev
mailing list