On Mon, Aug 30, 2021 at 10:37:28PM -0700, Christopher Barker wrote:
On Mon, Aug 30, 2021 at 10:22 AM Stephen J. Turnbull < stephenjturnbull@gmail.com> wrote:
Christopher Barker writes:
e.g.: what are the valid values?
That's easy: MyEnum.__members__.
Seriously? you are arguing that Enums are better because they are self documenting, when you have to poke at a dunder to get the information ?!?
Seems pretty easy to me. It has to be a dunder, or a sunder at least, because regular non-underscore names are reserved for the enumerations themselves. How do you programmatically get the information about which encoding error handlers the `open` function takes? I don't know how to get them programmatically, but today I learned how to get them from the documentation: * Start with help(open) * Page down two pages. * import codecs * help(codecs.Codec) That gives you the predefined error handlers, assuming the docs are up to date. I still don't know how to find out what extra handlers have been installed.
I want to (in iPython) do:
statistics.median?
and see everything I need to know to use it
Okay, so if the API is (say) this: def median(data, *, nans='ignore'): ... will iPython give you a list of all the other possible strings that are accepted? How does it know? -- Steve