added type check to look for objects with _getitem_ Fixes #7985

```
>>> d[1].subs(d, {1: 2})
{1: 2}[1]
>>> {1: 2}[1]
2
```
so should I add 
``` python
 assert 2 = d[1].subs(d, {1: 2})
 ```
 in the tests