Nice so it will give an error like this now ? If so, nice!
```
TypeError: Key “name” cannot be used with “NoneType” because it’s not
subscripts or
```
---
[Visit
Topic](https://discuss.python.org/t/small-suggestion-regarding-type-errors-and-subscription/67898/3)
or reply to this email to
Do you mean like this?
```
$ python -c 'print({"profile":None}["profile"]["name"])'
Traceback (most recent call last):
File "", line 1, in
print({"profile":None}["profile"]["name"])
~~~
TypeError: 'NoneType' object is not subscriptable
```
This i
No, it will give the error message @jamestwebber showed. Try it out in a python
shell! That is the easiest way to figure out exactly how a feature behaves.
---
[Visit
Topic](https://discuss.python.org/t/small-suggestion-regarding-type-errors-and-subscription/67898/4)
or reply to this emai
https://peps.python.org/pep-0657/
---
[Visit
Topic](https://discuss.python.org/t/small-suggestion-regarding-type-errors-and-subscription/67898/5)
or reply to this email to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from these emails, [click
her
[quote="James Webber, post:2, topic:67898, username:jamestwebber"]
confirmed it’s new in 3.13
[/quote]
This should be available since 3.11
https://docs.python.org/3/whatsnew/3.11.html#pep-657-fine-grained-error-locations-in-tracebacks
But it seems the old REPL didn't show them properly.
So I th
That makes much more sense. I was sure I had seen it before 3.13, but it must
have been in a notebook or somewhere else where it displayed properly. I don't
use the base REPL very often.
---
[Visit
Topic](https://discuss.python.org/t/small-suggestion-regarding-type-errors-and-subscription
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”] # Ty
Thank you Alyssa for this detailed answer.
---
[Visit
Topic](https://discuss.python.org/t/venv-activate-script-changes-path-while-executing-the-binary-doesnt/67580/12)
or reply to this email to respond.
You are receiving this because you enabled mailing list mode.
To unsubscribe from the