Re:Go 1.17 is deprecating the traditional use of 'go get'
by pwdisswordfish8 on Saturday June 26, 2021 @04:34AM
(#27640210)
You missed the point. It’s not about names themselves. What happens if I want to lookup bytestring-named attributes on a class defined in a Unicode-string module or vice versa?
[ Parent
| on HN ]
Re:Go 1.17 is deprecating the traditional use of 'go get'
by ByteJockey on Sunday June 27, 2021 @01:42AM
(#27648916)
Ahh, the wording screwed me up.
If I'm understanding your comment correctly this time, it would look something like:
getattr(thing, b'attribute_name')
Re:Go 1.17 is deprecating the traditional use of 'go get'
by im3w1l on Sunday June 27, 2021 @08:54PM
(#27656961)
I guess you could make it work as long as everything is ascii right? And if it's not then raise exception.
Re:Go 1.17 is deprecating the traditional use of 'go get'
by ByteJockey on Saturday July 03, 2021 @11:01AM
(#27722027)
If it's not ascii, you would just do:
getattr(thing, u'attribute_with_unicode_characters')
This would work in both python 2.7 and 3.9 (probably works with other 3.X versions but it's the one I actually tried).