Giovanni Bajo wrote: > Another (similar) way would be to let the user pay for the high typechecking > price in normal cases *but* provide a list[int] class, which is a list > decorated with typechecks on modification operations. We could have > list[int|float]() to construct a list which can hold either ints or floats.
This is worth thinking about. Recently when pondering the question of when it would or would not be appropriate to put in type assertions to help catch bugs, I concluded that it makes the most sense to do so when building a data structure, but not when just passing things around between calls. The most difficult-to-debug type errors are the ones where you've put something of the wrong type into a data structure, and it's sat there for a while not causing any obvious problem until something else tries to use it, by which time most evidence of where it came from is gone. So data structures which automatically check what you put into them could be handy to have. -- Greg _______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com