A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2001-January/012052.html below:

[Python-Dev] Is X a (sequence|mapping)?

[Python-Dev] Is X a (sequence|mapping)? [Python-Dev] Is X a (sequence|mapping)?Martin v. Loewis martin@mira.cs.tu-berlin.de
Tue, 23 Jan 2001 09:14:32 +0100
> i don't see an easy way to test if something supports one of these
> abstract interfaces in Python.

Why do you want to test for that? If you have an algorithm that only
operates on integer-indexed things, what can you do if the test fails?

So it is always better to just use the object in the algorithm, and
let it break with an exception if somebody passes a bad object.

Regards,
Martin



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