On Oct 8, 1:18 pm, Kääriäinen Anssi <[email protected]> wrote:
> I am currently debugging the django test cases, and there are a lot of
> variables names like w, q, where, condition and so on. Especially variables
> like w, q, c, r are really annoying. It would be cool if pdb would detect a
> clash and in that case ask you what to do. Nothing more annoying than
> stepping through the code, finally finding the problematic place and then
> trying to find out what c.somevar contains... I am using Python 2.6.
>
> Is there some way to do this? My googling didn't turn out anything. Or is it
> recommended to use something else instead of pdb?
>
> Thank you for your time,
> - Anssi Kääriäinen
Its not perfect but I use in sitecustomize
def precmd(self,l):
if '.' in l:
if l[:1]!='!':l='!'+l
return l
if l in self.curframe.f_locals:
return '!'+l
if l.startswith('@'): return l[1:]
return l
import pdb
pdb.Pdb.precmd = precmd
What this does is
q ->variable q if it exists else quit command
@q ->always quit
!q ->always variable
HTH
Jon
--
http://mail.python.org/mailman/listinfo/python-list