If this provides you an error message on the specific key that’s missing 

```
class User:
  profile = None 

u = User()
u.profile.name # AttributeError: None does not have attribute name
```

Then may I suggest that this has the same ?

```
user = {
“profile”: None
}
user[“profile”][“name”] # TypeError: None is not subscripable
```

Currently doesn’t indicate which key triggered this which isn’t helpful in 
software that will send the high level exception message to you.

There has been recent discussion in the null operator thread that statements 
like this should always make clear which part failed

But python even today doesn’t always do this





---
[Visit 
Topic](https://discuss.python.org/t/small-suggestion-regarding-type-errors-and-subscription/67898/1)
 or reply to this email to respond.

You are receiving this because you enabled mailing list mode.

To unsubscribe from these emails, [click 
here](https://discuss.python.org/email/unsubscribe/525c7e6daa421f0446e4e4e62f7c525b204d8fda7ca4adf1b9f49f03c634711b).

Reply via email to