Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36653

Re: Problem with importing in Python

Newsgroups comp.lang.python
Date 2013-01-11 14:38 -0800
References <1eb7cd76-ade3-4c34-8816-6eaa7201262e@googlegroups.com> <mailman.416.1357943251.2939.python-list@python.org>
Subject Re: Problem with importing in Python
From su29090 <129km09@gmail.com>
Message-ID <mailman.418.1357943914.2939.python-list@python.org> (permalink)

Show all headers | View raw


On Friday, January 11, 2013 5:27:21 PM UTC-5, Chris Angelico wrote:
> On Sat, Jan 12, 2013 at 9:17 AM, su29090  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

 It worked! Thanks so much! :)

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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