From: Neal N. <ne...@me...> - 2002-05-16 18:23:53
|
Roman Suzi wrote: > > On Thu, 16 May 2002, Neal Norwitz wrote: > > >On Mon, 13 May 2002 09:29:46 -0400, Roman Suzi wrote: > >> I am pychecking my code and am getting lots of: > >> > >> stable.py:210: Variable (path) used before being set > >> > >> These are caused by from-import statements inside functions, > >> schematically: > >> > >> def f(x): > >> from m import y > >> return y(x) > >> > >> Is it really considered bad to use from-import inside function > >> definition? (I did it because I wanted to state clearly which functions > > > >I don't think it is particularly bad. It could be a bug in pychecker. > >Which version of pychecker & python? > > python 1.5.2 (same with 2.1, IIRC) > pychecker-0.7.5 Wow, that's almost a year old! Things have changed a bit since then. :-) I believe the problem is fixed in the current version--0.8.10. I will probably release a new version soon. The new version fixes a few bugs and adds deprecation warnings, as well as using string exceptions and defining True/False. > >> Another question. Is there any front-end to pychecker to show code in > >> proper context and an ability to silence certain warnings just like I do > >> in ispell if I consider some word correct? > > > >There is a simple GUI which isn't documented: pychecker/options.py. But > >you are probably much better off with an IDE, emacs, boa, or wingide. > >(I've only used emacs.) > > pychecking from Emacs? I can't find anything under C-h b > in python-mode... Barry added this recently to python mode, so you'll have to wait a bit (or get from CVS), but M-x compile works. Then you can do 'pychecker *.py' for the command (or whatever you want). The warnings will come up and you can do C-x ` to move to the warnings. > >There are many ways to silence warnings: using __pychecker__ in your > >code, .pycheckrc file, or the command line all work. Probably the best > >way is .pycheckrc. There is a sample one in the distribution (pycheckrc). > > Can't locate it on my machine... The file is not in the rpms, you can get it here: http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/pychecker/pychecker/pycheckrc?rev=HEAD&content-type=text/plain If you want the file from version 0.7.5, change HEAD -> v0_7_5 Neal |