[Python-ideas] pdb.set_trace may not seem long

anatoly techtonik techtonik at gmail.com
Mon Apr 9 20:59:43 CEST 2012

On Mon, Apr 9, 2012 at 9:13 PM, Guido van Rossum <guido at python.org> wrote:
> On Mon, Apr 9, 2012 at 10:45 AM, anatoly techtonik <techtonik at gmail.com> wrote:
>> On Mon, Apr 9, 2012 at 5:20 PM, Yuval Greenfield <ubershmekel at gmail.com> wrote:
>>> Proposal:
>>> pdb.st = pdb.set_trace
>>> -----------
>>> I find myself typing this a lot:
>>>     import pdb;pdb.set_trace()
>> How about?
>>    import pdb.trace
> Yuck. An import intended to have a side effect.

On the other side it is an import intended to debug side effects.
Syntax sugar that makes debugging in Python more intuitive. I always
land on stackoverflow when I need to recall the structure of this pdb
import call. In ideal world it would be even something like:

    import debug.start

but of course, a builtin


which calls registered debugger for an application or pdb (by default)
could be even more shorter and easy for newbies at the cost of added

> This also won't work
> if pdb.trace was imported before.

Can pdb.trace remove itself from sys.modules while being imported?

More information about the Python-ideas mailing list