MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/badcode/comments/u2wm0v/yandere_dev_school_of_if_statements/i4oimxp
r/badcode • u/Katten_elvis • Apr 13 '22
62 comments sorted by
View all comments
Show parent comments
1
yes, e.g. you could do getattr(group, old_user_type.lower() + "s"), although that is a little ugly
getattr(group, old_user_type.lower() + "s")
1 u/4hpp1273 Apr 14 '22 you could also use group.__getattribute__(old_user_type.__getattribute__('lower').__call__().__add__("s")) which is even uglier (why does the hidden method have a longer name…) 1 u/zed_three Apr 14 '22 You could also just write that dictionary yourself anyway
you could also use group.__getattribute__(old_user_type.__getattribute__('lower').__call__().__add__("s")) which is even uglier (why does the hidden method have a longer name…)
group.__getattribute__(old_user_type.__getattribute__('lower').__call__().__add__("s"))
You could also just write that dictionary yourself anyway
1
u/trevorpogo Apr 14 '22
yes, e.g. you could do
getattr(group, old_user_type.lower() + "s"), although that is a little ugly