Who's minister of propaganda this week?

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Sun Mar 18 18:15:02 EST 2001


Sun, 18 Mar 2001 21:55:59 +0100, Alex Martelli <aleaxit at yahoo.com> pisze:

> For example, say that you want to organize certain objects in a
> container/contained hierarchy, with no nesting limits.
> 
> All existing objects will be leaves in the resulting tree.  Why does
> this imply that such existing objects need to inherit from a certain
> interface asserting "I may or may not be a container" (perhaps with
> a default implementation stating "I am _not_ a container after all")?

It doesn't imply that.

> In a dynamically typed language, you will define an interface
> (and perhaps a default implementation thereof) *only for container
> objects*, i.e., the "new" organizing superstructure.  Each container
> will hold a set (e.g. a list, or dict) of (suitably tagged)
> references to other objects; for recursive walks on the tree, one
> will dynamically test whether a given object is-a container (else,
> it's a leaf).

In a statically typed language I would just recognize leafs on the
container side, without relying on any properties of objects in
leafs themselves.

You solved a problem which did not exist.

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list