6 ms·
just a guess but if .json was implemented as a property and deserialization fails, you would get an AttributeError instead of the error reporting that there was
by tbatterii 14y ago
just a guess but if .json was implemented as a property and deserialization fails, you would get an AttributeError instead of the error reporting that there was a problem with deserialization. leaving it a method call would allow for the real error to bubble up as normal.
- kenneth_reitz 14y agoBingo :)
- tbatterii 14y agoi pretty much stopped using properties after I got bit by that. :)
- ianb 14y agoWhere does this happen? I'm not seeing it: https://gist.github.com/4329831 https://gist.github.com/4329831 – the exception seems to come through just fine?
- kenneth_reitz 14y agoFeels weird. You shouldn't need to catch an exception when accessing an attribute.