[Python-ideas] Adding "Typed" collections/iterators to Python
Terry Reedy
tjreedy at udel.edu
Wed Dec 21 00:01:26 CET 2011
On 12/20/2011 1:50 PM, Nathan Rice wrote:
> I put a module called "elementwise" on pypi
> (http://pypi.python.org/pypi/elementwise/0.111220) that implements my
> idea of what a nice broadcast proxy should do.
I downloaded and took a brief look. I hope to get back to it later.
2.) there are serious dragons in
> how python handles complex inheritance graphs that result in
> "object.__new__() takes no parameters", despite not having any builtin
> bases and having no base class overriding __new__ or __init__
Best not to use object as the apex of multiple inheritance.
> Because "typed" is sort of a dirty word in the python community,
Not exactly true, and unnecessarily combative. More true is that
careless use of 'typed' has gotten tiresome. Python is strongly
dynamically typed. But people occasionally post -- again the same day
you posted to python list -- that Python is weakly typed. I am tired of
explaining that 'typed' is not synonymous with 'statically typed'.
Or consider your subject line. Python collections are typed both as to
collection object and the contents. Python has narrow-content typed
sequences. So just saying you want 'typed collections' does not say
anything. We already have them. We even have propagation of
narrow-content typing for operations on bytes and strings.
But we do not have anything similar for numbers or user classes. And
that might be worthwhile. So your subject seems more like 'adding
generic narrowly typed sequences to Python'.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list