Skip to content

The behavior of not breaking at the first line if a breakpoint is set can be highly confusing. #3230

@greazer

Description

@greazer
  1. Create a script that looks like this...

get_ipython().run_line_magic('matplotlib', 'inline')
import random
import math
import matplotlib.pyplot as plt
import numpy as np
import pymc3 as pm

def roll_die():
return random.randint(1, 6)

def roll_dice():
return roll_die() + roll_die()

print(roll_dice())
print(roll_dice())
print(roll_dice())

#%%
def roll_histogram(samples):
rolls = []
for _ in range(samples):
rolls.append(roll_dice())

fig, ax = plt.subplots(figsize=(12, 9))
plt.hist(rolls, bins=11)

roll_histogram(100000)

  1. Debug through the first cell --- Press "Debug cell" and then F10 through it. Notice that when you hit a "def" line the debugger steps over it because it's a function after all. Find yourself squealing in enjoyment as you step over each individual print(roll_dice()) and see the output as it happens.
  2. Do the same for the next cell. Step over "def roll_histogram" then F10 on the call to it.
  3. Bug1 (Not the topic of THIS bug) - the F10 doesn't return successfully and complains about not finding a source file.
  4. Stop debugging.
  5. Scratch your chin and decide that you want to step into the debug the roll_histogram() function.
  6. Set a breakpoint on the first line.
  7. Press Debug cell again.

Get freaked out that it seems like the debugger is accidentally stopping at a breakpoint in roll_histogram() BEFORE it's called. Then realize that is not happened. What's happening is that since you entered a breakpoint in the cell, the Debug cell function runs to it.

I don't think this is a good idea anymore.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions