Creating a module that uses itself

Asheesh Laroia pan-news at asheeshenterprises.com
Mon Mar 18 07:01:47 EST 2002


Oops.

I accidentally tried to create an Image() object instead of a Photo()
object.  The interesting thing about this is that there *is no* Image
object.

(Sorry, all.)  It was just syntax error disguised as a logic error.

Back to sleep, all of you.  Looks like I could use some myself.  Thanks,
anyway....

-- Asheesh.

On Mon, 18 Mar 2002 01:47:51 -0500, Greg Krohn wrote:

> "Asheesh Laroia" <pan-news at asheeshenterprises.com> wrote in message
> news:2yfl8.113994$nl1.19520473 at typhoon.nyroc.rr.com...
>> I'm writing a PageMaker-to-specialized-HTML module (henceforth
>> "pm2html").  In the module, I define the classes Article, Headline, and
>> Photo, among others.
>>
>> In the Article class, I want to have a Headline object.  Is this
>> possible?  Right now, ActivePython's PythonWin spits a syntax error at
>> me because the Headline class is not defined.
> 
> You should post your code and the actual error traceback. What you're
> describing should work -- at least they way that you've described it.
> Could there be a typo in your code?
> 
> This works for me:
> 
> class Article:
>     def __init__(self):
>         self.headline = Headline()
> 
> class Headline:
>     pass
> 
> class Photo:
>     pass
> 
> a = Article()
> 
> 
> 
> greg



More information about the Python-list mailing list