[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Python curses



On Tue, Jan 10, 2023 at 09:01:17AM -0500, paulf@quillandmouse.com wrote:
> On Tue, 10 Jan 2023 08:34:05 -0500
> Greg Wooledge <greg@wooledge.org> wrote:
> 
> > On Tue, Jan 10, 2023 at 08:24:11AM -0500, paulf@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". And
> > > Python was throwing exceptions. But based on what you wrote, I
> > > substituted "curses.A_REVERSE", which works.
> > > 
> > > Problem solved... 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. So I
> started investigated versions of Python, ncurses, Python curses, etc.
> 
> But as it turns out, instead of typing "A_REVERSE", I should have
> ignored the docs and typed "curses.A_REVERSE". That worked, and
> obviated the whole versioning problem.

Greg is still right, though:

If you say "import curses", then you have to say "curses.A_REVERSE"
later on. If you say "from curses import *", then it's "A_REVERSE".

The difference between importing a package and importing all of
the packages's symbols.

What you want to do depends on preferences, taste, name collissions
and things.

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


Reply to: