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 < > stephenjturnb...@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 _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OH4AW3LYS3355FORXY5OWVXCJRGFPEAE/ Code of Conduct: http://python.org/psf/codeofconduct/