Typing system vs. Java
aleaxit at yahoo.com
Mon Aug 6 16:33:57 CEST 2001
"Courageous" <jkraska1 at san.rr.com> wrote in message
news:6dtqmtg3klt5cosohslg742u1o746n1qqb at 4ax.com...
> >I haven't seen many such requests. Anyway, it's clearly trivial
> >to subclass UserList, overriding append and __setitem__ to make
> >sure the items being added satisfy some per-item test (be it
> >a type-test or something more clever) -- is that what you mean?
> Pretty much, yep.
> BTW, the "requests" for uniform containers I was referring to weren't
> necessarily for Python. :)
In other languages, the "uniform containers" may be FAR more
necessary than they are in Python. For example, in Java you
currently get the choice -- either a Vector with all of its niceties
BUT strictly Object as contents, OR an array with SOME level of
compile-time homogeneity (unfortunately bogus because of
covariance, but that's another issue) but very low-level operation.
THERE a Generic-Java able (among other things) to supply a
homogeneous "no casts needed on retrieval" equivalent of
Vector has been a sore need for many years.
But the need doesn't generalize to Python:-).
More information about the Python-list