Couple of noobish question

Catherine Heathcote catherine.heathcote at
Wed Feb 4 18:09:54 CET 2009

Mike Driscoll wrote:
> On Feb 4, 10:47 am, Catherine Heathcote
> <catherine.heathc... at> wrote:
>> Firstly hi, I don't know any of you yet but am picking up Python and
>> will be lurking here a lot lol. I am a hobbiest coder (did 3 out of 4
>> years of a comp tech degree, long story) and am learning Python, 'cos I
>> saw some code and it just looks a really nice language to work with. I
>> come from C++, so I am bound to trip up trying to do things the wrong way!
>> I have been working with Project Euler to get the hang of Python, and
>> all goes well. I have an idea for a small project, an overly simplistic
>> interactive fiction engine (well more like those old choose your own
>> adventure books, used to love those!) that uses XML for its map files.
>> The main issues I see so far is the XML parsing (I should pick that up
>> ok, I have a blackbelt in google-foo), but more importantly splitting
>> code files.
>> In C++ I would obviously split .cpp and .h files, pairing them up and
>> using #include. How do I do this in Python? I see that you don't tend to
>> split logic from defenition, but how do I keep different classes in
>> different files? My google-fu fails me so far.
> You just use the keyword "import". Here's a goofy example:
> 1) contains a class called Foo
> 2) contains a script that imports Foo:
> import foo
> # create an instance of the Foo class
> myFoo = foo.Foo()
> I hope that was clear.
> Mike

Perfect, thanks ^^

More information about the Python-list mailing list