Testing a class at the interactive prompt?

Discussion in 'Python' started by Dan Rawson, Aug 13, 2003.

  1. Dan Rawson

    Dan Rawson Guest

    How can I reload a class at the interactive prompt??

    >>> from MyClass import MyClass1
    >>> x = MyClass1()

    ...... edit MyClass.py to modify a method in another window . . .
    >>> reload(MyClass1) (or reload(MyClass), or ...)


    which fails

    >>> from MyClass import MyClass1


    doesn't give an error, but also doesn't get the newly modified method . . .

    TIA . . . .

    Dan
     
    Dan Rawson, Aug 13, 2003
    #1
    1. Advertising

  2. Dan Rawson

    Jp Calderone Guest

    On Wed, Aug 13, 2003 at 01:45:40PM -0400, Dan Rawson wrote:
    > How can I reload a class at the interactive prompt??
    >
    > [snip]
    >
    > >>> from MyClass import MyClass1

    >
    > doesn't give an error, but also doesn't get the newly modified method . . .
    >


    Don't use "from" imports here, and things will work as you desire.

    Jp
     
    Jp Calderone, Aug 13, 2003
    #2
    1. Advertising

  3. Dan Rawson <daniel.rawson.take!this!out!@asml.nl> writes:

    > How can I reload a class at the interactive prompt??
    >
    > >>> from MyClass import MyClass1
    > >>> x = MyClass1()

    > ..... edit MyClass.py to modify a method in another window . . .
    > >>> reload(MyClass1) (or reload(MyClass), or ...)


    >>> reload(MyClass)
    >>> from MyClass import MyClass1


    or

    >>> MyClass1 = MyClass.MyClass1


    'as
     
    Alexander Schmolck, Aug 14, 2003
    #3
    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. Kaizer
    Replies:
    3
    Views:
    261
    Kaizer
    Dec 10, 2005
  2. Jan Kanis

    interactive prompt in IDLE

    Jan Kanis, Jan 29, 2007, in forum: Python
    Replies:
    0
    Views:
    251
    Jan Kanis
    Jan 29, 2007
  3. gaurav kashyap
    Replies:
    2
    Views:
    622
    gaurav kashyap
    Oct 30, 2008
  4. gaurav kashyap
    Replies:
    3
    Views:
    688
    gaurav kashyap
    Oct 31, 2008
  5. Mel
    Replies:
    10
    Views:
    3,128
    Sailaja Appi
    Feb 13, 2009
Loading...

Share This Page