The Pythonic way here is to just use a normal dictionary and only add objects of a particular type to it - don't try to enforce the restriction, it shouldn't be necessary.
Edit: To expand my argument, let me explain - you seem to be under the impression that writing good code requires type safety. The first question is why? Sure, type safety catches some errors at compile time, but in my experience, those errors are rare, easy to catch with even the most trivial testing, and generally easy to fix.
By contrast, the most annoying, hard to fix, and hard to test for bugs are logical ones, that the computer can't spot at all. These are best prevented by making readable code that is easy to understand, so errors stand out more. Dynamic typing massively helps with that by reducing the verbosity of code. You can argue typing makes it easier to read the code (as one can see the types of variables as you use them), but in dynamic languages, this kind of thing is given by naming carefully - if I name a variable seq
, people will presume it's a sequence and can be used as such. A mixture of descriptive naming and good documentation makes dynamic code far better, in my experience.
When it comes down to it, type safety in a language is a matter of preference, however, Python is a dynamic language designed around the idea of duck typing. Everything in the language is designed around that and trying to use it in another way would be incredibly counter-productive. If you want to write Java, write Java.