Nathan Rice wrote:
To avoid handcuffing people with types (which is definitely un-pythonic) and maintain backwards compatibility, the standard collection modification methods could be hooked so that if an object of an incorrect type is added, a warning is raised and the collection gracefully degrades by removing mixed-in type information and methods.
-1 to automatic downgrading. Imagine in step C that the collection is auto-downgraded and later in step Q a method is called that no longer exists -- Exception raised. (I find a Warning less than useful -- either you aren't going to use one of the special methods, in which case you didn't need the special container and the warning is just noise, or you do need the special methods and you'll get an exception further on when you try to use it and it's no longer there.)
Additionally, a method could be provided that lets the user "terminate the contract" causing the collection to degrade without a warning.
+1 Either it was not needed to begin with, or the need has been satisfied and now we need to add in objects with a different type
Do you have some examples of functions where you pass in a container object and get the same type of object back, but it's a different object?