On 4/22/07, Samuele Pedroni <[EMAIL PROTECTED]> wrote: > If we keep s % d (do we? reading the list archives and the peps didn't > give an answer, I suppose it depends if PEP 3101 is accepted): > > will it check if d is a Mapping or continue to use the current heuristics? > > I suppose this is a legitimate question for other corners of the > language, std lib.
Any place that currently uses a heuristic should be changed to check for Mapping instead (actually, in this particular case BasicMapping, as the % operator doesn't need to iterate over the keys or items). And most places that currently check for a dict should probably check for a Mapping or BasicMapping as well. BUT BUT BUT -- this is only for places that already check (like s%d). Places that just plunge in and call __getitem__ should continue to do so and should not be modified to require a flavor Mapping. Similarly, assignment to sys.stdout shouldn't be constrained to subclasses of io.IOBase; we can and should continue to use duck typing where it makes sense. PS. I fully intend to be dropping s%d in favor of the PEP 3101 solution. -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
