Beginners question about debugging (import)

  • Thread starter Albert van der Horst
  • Start date
A

Albert van der Horst

I'm starting with Python. First with some interactive things,
working through the tutorial,
then with definitions in a file called sudoku.py.
Of course I make lots of mistakes, so I have to include that file
time and again.

I discovered (the hard way) that the second time you invoke
from sudoku.py import *
nothing happens.

There is reload. But it only seems to work with
import sudoku

Now I find myself typing ``sudoku.'' all the time:

x=sudoku.sudoku()
y=sudoku.create_set_of_sets()
sudoku.symbols

Is there a more convenient way?

(This is a howto question, rather difficult to get answered
from the documentation.)

Groetjes Albert



~
 
D

Diez B. Roggisch

Albert said:
I'm starting with Python. First with some interactive things,
working through the tutorial,
then with definitions in a file called sudoku.py.
Of course I make lots of mistakes, so I have to include that file
time and again.

I discovered (the hard way) that the second time you invoke
from sudoku.py import *
nothing happens.

There is reload. But it only seems to work with
import sudoku

Now I find myself typing ``sudoku.'' all the time:

x=sudoku.sudoku()
y=sudoku.create_set_of_sets()
sudoku.symbols

Is there a more convenient way?

(This is a howto question, rather difficult to get answered
from the documentation.)

import sudoku as s

However, I find it easier to just create a test.py and run that from the
shell. For the exact reason that reload has it's caveats and in the end,
more complex testing-code isn't really feasible anyway. If you need to,
drop into the interactive prompt using

python -i test.py

Diez
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top