PEP 284, Integer for-loops

James_Althoff at i2.com James_Althoff at i2.com
Mon Mar 11 21:04:34 CET 2002


[Hernan M. Foffani]
|James, is it too difficult to extend java inherited classes
|to behave in a more pythonic tradition way?
|
|For instance, instead of collection.getCount() have the
|chance to use collection.__len__()?
|
|I guess that is not possible to override a superclass,
|right?

That's a good suggestion and we like doing that kind of thing when
possible.  And you *can* define Jython subclasses that inherit from and
override Java superclasses -- that being one of the things that makes
Jython so usable in a Java environment.

Two dimensional collections (e.g., tables) are trickier than one
dimensional sequences, however.  In such cases __len__ is not well-defined.

Jim Althoff
Senior Vice President
i2 Technologies, Inc.





More information about the Python-list mailing list