Thinking about the best way to handle command registrationSuppose that you have a Python utility program that does a number of
related things; it's invoked as ' Since I have been writing such a utility program, I have found myself wondering what the best way of doing this is (where 'best' means 'most natural, obvious, and easy to follow'). So far I've come up with a number of possible ways:
Naturally you can combine aspects of all of these together to create hybrid systems (for example, using the function's docstring for some of the user help text). Of these, I suspect that the decorator function approach is the most Pythonic but is also the second hardest for people who are not experienced Python programmers to follow (introspection would probably be the hardest). Since that last issue is a consideration, I am leaning towards using the plain registration function approach. (My current code mostly uses the simple dictionary approach, but it's not the clearest thing to follow.) (4 comments.)
|
These are my WanderingThoughts GettingAround This is part of CSpace, and is written by ChrisSiebenmann. * * * Atom feeds are available; see the bottom of most pages. Categories: links, linux, programming, python, snark, solaris, spam, sysadmin, tech, unix, web |