If I have an attribute self.internal/freezer
in a class, and I raise an error via (raise (AttributeError f"Sorry! '{attr}' doesn't exist as an attribute!"))
, how can I get the attribute name to render as internal/freezer
instead of hyx_internalXsolidusXfreezer
? For example, I already tried (hy.eval attr)
with the f-string
, but it still came out mangled.
Asked
Active
Viewed 33 times
0

ShadowRylander
- 361
- 2
- 8
-
1Did you read this section, which I linked you to earlier? https://docs.hylang.org/en/master/language/syntax.html#mangling – Kodiologist Jan 19 '22 at 21:27
-
I just did; thank you! Er... Which question did you link that in, again...? And I just found the documentation for `unmangle` in the hy core docs. – ShadowRylander Jan 19 '22 at 22:00
-
1Here: https://stackoverflow.com/a/70690752 – Kodiologist Jan 19 '22 at 22:46
-
Oh, lord, yes; I'm so sorry, I just read the example! Thank you so much for all the help! Should I just answer my own question, then? – ShadowRylander Jan 19 '22 at 23:08
-
1Sounds like a plan. – Kodiologist Jan 20 '22 at 00:26
-
Done! Thanks again! – ShadowRylander Jan 20 '22 at 01:59
1 Answers
2
Thanks to @Kodiologist in the comments linking the mangling section in hylang's syntax documentation; unamgling
can be achieved via the aptly named hy.unmangle
function, documented here as well.

ShadowRylander
- 361
- 2
- 8