On Sun, Jun 28, 2009 at 18:47, Jakub Wilk<uba...@users.sf.net> wrote: > * Sandro Tosi <mo...@debian.org>, 2009-06-28, 17:09: >>> >>> I find it perfectly reasonable that python-gtk2 issues a warning; in >>> *most cases* the module has limited usefulness when $DISPLAY is not set to a >>> valid value. >> >> ok, so this is informative for a user, but how can this be useful for a >> program? > > The nice thing about warnings is that you can silence them or you can turn > them into exceptions:
sure, so consider this situation: - we silence the warning; - a user really wants to use the Gtk+ gui, but has not set DISPLAY (because messed up environment, or 1000s other reasons) - no warning is issued but the gui won't start and we receive a bug report because the Gtk+ gui doesn't work. Should I silence the warning or not? I don't think so. > Don't get me wrong: I don't claim that issuing a warning is an optimal > solution for dealing with missing $DISPLAY. It's just *better* than raising > an exception at import time. To inform people using it, not programs importing the module. There are 2 situations: - the modules does not really work, so raise an exception - the module can work, even if with limited functionalities, so don't issue a warning > Importing a module might be useful even if the module did not "work", as you > could still: > - Import it to ensure that it is *installed*. (And if it were not, instruct > the user to install python-something.) > - Import it to inspect the module contents (e.g. read docstrings). Ok, so don't issue a warning at import time (because it still could be interesting have a "limited functionalities" module loaded) but raise an exception the very moment you're calling a method needing DISPLAY. Programs will handle exception. Regards, -- Sandro Tosi (aka morph, morpheus, matrixhasu) My website: http://matrixhasu.altervista.org/ Me at Debian: http://wiki.debian.org/SandroTosi -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org