[Python-Dev] os.path.walk() lacks 'depth first' option

Delaney, Timothy C (Timothy) tdelaney@avaya.com
Tue, 13 May 2003 10:00:00 +1000


> From: Guido van Rossum [mailto:guido@python.org]
>=20
> OTOH there's something to say for fewer errors, not more;
> e.g. sometimes I wish AttributeError and TypeError were unified,
> because AttributeError usually means that an object isn't of the
> expected type.

Hmm ... I was going to ask if there was any reason not to make =
AttributeError a subclass of TypeError, but that would mean that code =
like:

    try:
        ...
    except TypeError:
        ...

would also catch all AttributeErrors.

Maybe we should have a __future__ directive and phase it in starting in =
2.4?

I wouldn't suggest making AttributeError and TypeError be synonyms =
though ... I think it is useful to distinguish the situations.

I can't think of any case in *my* code where I would want to distinguish =
between a TypeError and an AttributeError - usually I end up having:

    try:
        ...
    except (TypeError, AttributeError):
        ...

Tim Delaney