Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36649
| References | <1eb7cd76-ade3-4c34-8816-6eaa7201262e@googlegroups.com> |
|---|---|
| Date | 2013-01-12 09:27 +1100 |
| Subject | Re: Problem with importing in Python |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.416.1357943251.2939.python-list@python.org> (permalink) |
On Sat, Jan 12, 2013 at 9:17 AM, su29090 <129km09@gmail.com> wrote: > Circle.py > > class circle: > > from Circle import Circle Inside the Circle module is a class named circle. You can't import Circle from that. But Python isn't Java. You don't have to put each class into its own file. Just put class circle (or class Circle to follow Python naming convention) into the other file, whose name you haven't given. If they're already in the same file, then just drop the import. Easy! By the way: > main() # Call the main function You'll need to put that flush left. At the moment, that call is part of the definition of main(). Hope that helps! ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 14:17 -0800
Re: Problem with importing in Python Adnan Sadzak <sadzak@gmail.com> - 2013-01-11 23:25 +0100
Re: Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 14:29 -0800
Re: Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 14:29 -0800
Re: Problem with importing in Python Chris Angelico <rosuav@gmail.com> - 2013-01-12 09:27 +1100
Re: Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 14:38 -0800
Re: Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 14:38 -0800
Re: Problem with importing in Python Dave Angel <d@davea.name> - 2013-01-11 17:43 -0500
Re: Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 15:23 -0800
Re: Problem with importing in Python su29090 <129km09@gmail.com> - 2013-01-11 15:23 -0800
Re: Problem with importing in Python Tim Roberts <timr@probo.com> - 2013-01-11 20:37 -0800
Re: Problem with importing in Python Chris Angelico <rosuav@gmail.com> - 2013-01-12 15:54 +1100
Re: Problem with importing in Python Dave Angel <d@davea.name> - 2013-01-12 00:14 -0500
Re: Problem with importing in Python Terry Reedy <tjreedy@udel.edu> - 2013-01-11 22:53 -0500
csiph-web