On Tue, 10 Jan 2023 13:17:10 -0600 David Wright <deb...@lionunicorn.co.uk> wrote:
> On Tue 10 Jan 2023 at 11:13:55 (-0500), pa...@quillandmouse.com wrote: > > On Tue, 10 Jan 2023 09:31:26 -0600 > David Wright > > <deb...@lionunicorn.co.uk> wrote: > > > > You keep mentioning "the docs" without saying which docs, so a > > > reference might be helpful. > > > > Sorry. I'm using the following (and related pages): > > > > https://docs.python.org/3/library/curses.html > > > > These appear to be the most authoritative. > > Correct. > > > > On Tue 10 Jan 2023 at 09:01:17 (-0500), pa...@quillandmouse.com > > > wrote: > > > > On Tue, 10 Jan 2023 08:34:05 -0500 Greg Wooledge > > > > <g...@wooledge.org> wrote: > > > > > On Tue, Jan 10, 2023 at 08:24:11AM -0500, > > > > > pa...@quillandmouse.com wrote: > > > > > > What you wrote triggered something. I'd been following the > > > > > > Python curses docs, which tell you to write, for example, > > > > > > "A_REVERSE". > > No, they don't. > > > > > > > And Python was throwing exceptions. But based on > > > > > > what you wrote, I substituted "curses.A_REVERSE", which > > > > > > works. > > > > > > > > > > > > Problem solved... for now. > > > > > > Exactly: just for now. > > > > > > > > I'm a Python novice, but I believe what you're seeing is the > > > > > difference between > > > > > > > > No, here's what happened. I was going along, and I used > > > > "A_REVERSE" in my code, according to the online docs. > > > > Exception, didn't recognize the name. That didn't make sense; > > > > this attribute is basic to curses. > > Exactly, it's an attribute, as shown by the heading of the table > in which you found A_REVERSE. And that attribute is a part of > the curses module, and must be qualified with curses.A_REVERSE > unless you import A_REVERSE (or all, *) into your namespace. > Correct. Actually, this should have been obvious to me if I'd been thinking clearly. Doing a "import curses" shouldn't make bare library symbols available in your code. It only makes sense you'd need to address them with a prefix. It may be argued that I shouldn't do the import this way. However, I prefer to have "curses." in front of things imported. It makes the link explicit, and serves to remind me of what's actually going on, when I revisit the code in five years. Paul -- Paul M. Foster Personal Blog: http://noferblatz.com Company Site: http://quillandmouse.com Software Projects: https://gitlab.com/paulmfoster