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/2001-January/012403.html below:

[Python-Dev] Re: Sets: elt in dict, lst.include

[Python-Dev] Re: Sets: elt in dict, lst.include [Python-Dev] Re: Sets: elt in dict, lst.includeSkip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 31 Jan 2001 16:27:38 -0600 (CST)
>>>>> "Tim" == Tim Peters <tim.one@home.com> writes:

    >> (Obviously, lists *do* understand __getitem__ at some level.  Why
    >> isn't it exposed in the method table?)

    Tim> The old type/class split: list is a type, and types spell their
    Tim> "method tables" in ways that have little in common with how classes
    Tim> do it.

The problem that rolls around in the back of my mind from time-to-time is
that since Python doesn't currently support interfaces, checking for
specific methods seems to be the only reasonable way to determine if a
object does what you want or not.

What would break if we decided to simply add __getitem__ (and other sequence
methods) to list object's method table?  Would they foul something up or
would simply sit around quietly waiting for hasattr to notice them?

Skip




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