Python is dynamic, so you can override what dict means in any of your areas, while the Python syntax is completely non-programmable. That way, the Python parser can conclude, when it sees curly braces, that it should build a dict. The expression dict(..) should always be evaluated like any other function call; find name, build tuple argument, etc.
In fact, using container literals such as curly braces {} is the closest you can go to static type declarations in Python.
I think this influenced Python 3's decision to introduce literals such as s = {1,2,3} .
It happens that programmers reassign embedded python! I think this is mostly by mistake and mostly limited to local variables (and the Python namespaces make sure that it can't do too much harm!) Here's the Google Code Search for the reassignment code dict . I think the strangest example is dict = dict() ; by this point, it should be obvious what you are doing!
To do this does not mean that you must do it. Yes, for example, thinking that a dict should really be called hash in python and replacing another built-in hash call is not something you should do:
hash, checksum = dict, hash
:-)
Sample code that does this is directly in the Python standard library. That's right, from line 92 shelve.py:
def __init__(self, dict, protocol=None, writeback=False): self.dict = dict if protocol is None: protocol = 0 self._protocol = protocol self.writeback = writeback self.cache = {}
This is a very typical example; dict is used as an argument to the method, and no one notices and does not harm, since the method is very short. Use syntax highlighting for inline functions to figure this out, this is my suggestion.