Beginners question about debugging (import)

Discussion in 'Python' started by Albert van der Horst, Jan 22, 2008.

  1. 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



    ~

    --
    --
    Albert van der Horst, UTRECHT,THE NETHERLANDS
    Economic growth -- like all pyramid schemes -- ultimately falters.
    albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
    Albert van der Horst, Jan 22, 2008
    #1
    1. Advertising

  2. Albert van der Horst schrieb:
    > 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
    Diez B. Roggisch, Jan 22, 2008
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alex
    Replies:
    1
    Views:
    283
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Apr 19, 2004
  2. Mike P

    web service beginners question

    Mike P, Aug 18, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    737
    S. Justin Gengo
    Sep 21, 2004
  3. Roger stevenson

    Beginners Question Regarding Static Web Pages

    Roger stevenson, Apr 30, 2005, in forum: ASP .Net
    Replies:
    8
    Views:
    399
    Sam Samnah
    Jul 1, 2005
  4. Vitali Gontsharuk
    Replies:
    2
    Views:
    556
    Vitali Gontsharuk
    Aug 25, 2005
  5. Artur M. Piwko

    import/from import question

    Artur M. Piwko, Jun 29, 2003, in forum: Python
    Replies:
    1
    Views:
    828
    Peter Hansen
    Jul 2, 2003
Loading...

Share This Page