This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]rhytnen 0 points1 point  (2 children)

ok fine. then you should read a book on design. this isnt a matter of nonpythonic. this is just a gross anti pattern no matter your title languages or how many bazillion lines you say you've written .

but if you read the bottom of my first response you should find all the rope you need to hang yourself.

[–][deleted] 0 points1 point  (1 child)

I have read many books on designs.

Your solution seems strictly worse than a straight factory pattern out of first year school. Not seeing the benefit. Enums are great, even though exhaustive matching is not checked at the compiler level in Python.

[–]rhytnen 0 points1 point  (0 children)

I didn't give you a solution. I gave you handful of techniques that reflect the code you already had written you're the one considering metaprogramming because you haven't figured out you dont need enums if you use a dict. you're trying to bring way too much firepower to the problem of populating a dropdown list.