[Tutor] Two More Questions

Danny Yoo dyoo@hkn.eecs.berkeley.edu
Wed, 28 Feb 2001 20:56:51 -0800 (PST)


On Wed, 28 Feb 2001, Britt Green wrote:

> >doesn't work; as an optimization step, if Python sees that a module's
> >already loaded, it'll ignore any more 'import Blah' calls.  So we really
> >do need to force the issue, by using reload():
> >
> > >>> reload(Classes)
> ><module 'Classes' from 'Classes.pyc'>
> >
> >That's a wild shot in the dark, but perhaps this is what's happening for
> >you.
> 
> I quit out of IDLE and reloaded my files, and they worked fine. So if I make 
> changes to the file "Classes.py", I need to make the file calling it reload 
> it to get it to recognize those changes, correct?

Ah, good, so that was probably it.  I think there's also an IDLE option or
command to have it do the reload(), but perhaps I'm mistaken on that.



> Hmm...I guess what I was looking for was a way to call a class
> constructor that contained a multiline string. For example, say I have
> this class:
> x
> class Rooms:
>     def __init__(self, name, number description):
>         self.name = name
>         self.number = number
>         self.description = description
> 
> Now I when I call this class, if I wanted to have, say, a paragraph of
> text for the description, how would I enter it? I've tried a few
> different ways with the triple quotes, but Python seems to not like
> it.

Can you show us one of your example calls?