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/2002-March/021265.html below:

[Python-Dev] PEP 285, inheritance reversed

[Python-Dev] PEP 285, inheritance reversedScott Gilbert xscottg@yahoo.com
Fri, 15 Mar 2002 13:18:47 -0800 (PST)
Being a newbie on this list, I was hoping to keep my mouth shut a
little longer and just wait to see how your discussions rounded out,
but since the topic seems to have died, I figure I'll make my say:

Isn't the inheritance between bool and int backwards?

ints can be used as bools
longs can be used as bools
floats can be used as bools
lists can be used as bools
dicts can be used as bools
strings can be used as bools
etc... can be used as bools

bools can't be promoted to dicts
bools can't be promoted to lists
bools can be promoted to ints, longs, floats, and strings, (and a few
others) but only in a limited way.

In some OO fashion, doesn't all of this imply that ints, longs, lists,
dicts, strings, ... should derive from bool instead of bool deriving
from int?  Then bool implements __int__, __long__, __str__, __repr__,
or the C extension equivalent to promote where needed?

I suppose that breaks anything that assumes int, long, str, dict, list
derive from object directly though...  Otherwise does it cause a
problem?

Ok.  I'll go back to being quiet for a bit.

Cheers,
    -Scott




ps: The intro to the list said I should introduce myself...  I'm a
software engineer living and working in Tucson, Arizona.  The company I
work for has started using Python in a larger and larger capacity for
digital signal processing and other misc scientific computing.  I've
followed the language for 3-4 of years now.


__________________________________________________
Do You Yahoo!?
Yahoo! Sports - live college hoops coverage
http://sports.yahoo.com/



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