mahmoud / glom

☄️ Python's nested data operator (and CLI), for all your declarative restructuring needs. Got data? Glom it! ☄️
https://glom.readthedocs.io
Other
1.89k stars 61 forks source link

`T.__()` dunder helper #168

Closed mahmoud closed 4 years ago

mahmoud commented 4 years ago

At the moment T reserves all dunders; you can't access a dunder attribute with a T. Some of these would probably work to open (e.g., __dict__) but others definitely wouldn't (e.g., __class__). So, a method called __ which would help access all dunders.

T.__('dict__') to access __dict__ and so on. It's not perfect, but it could be worse, and I can't think of anything much better. It's very unlikely to collide with any real attributes at the very least.

Also, the error message when a user tries to access a dunder attribute should also be changed to redirect them to use the method.

PS T.__() kinda looks like a Hugh aka Third of Five smiley/kaomoji.

kurtbrose commented 4 years ago

https://github.com/mahmoud/glom/pull/171

mahmoud commented 4 years ago

Done!