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


Groups > comp.lang.python > #36653

Re: Problem with importing in Python

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <129km09@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'much!': 0.05; 'main()': 0.07; 'python': 0.09; 'flush': 0.09; 'friday,': 0.09; 'to:addr:comp.lang.python': 0.09; 'way:': 0.09; 'cc:addr:python-list': 0.10; 'file,': 0.15; 'sat,': 0.15; 'helps!': 0.16; 'java.': 0.16; 'main().': 0.16; 'naming': 0.16; 'subject:Problem': 0.16; 'wrote:': 0.17; 'jan': 0.18; '(or': 0.18; 'module': 0.19; 'file.': 0.20; 'import': 0.21; 'cc:2**0': 0.23; "haven't": 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header :User-Agent:1': 0.26; 'am,': 0.27; 'chris': 0.28; 'definition': 0.29; 'class': 0.29; 'that.': 0.30; 'function': 0.30; '11,': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'but': 0.36; '12,': 0.36; 'subject:with': 0.36; 'drop': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; "you'll": 0.62; 'circle': 0.65; '2013': 0.84; 'easy!': 0.84
Newsgroups comp.lang.python
Date Fri, 11 Jan 2013 14:38:30 -0800 (PST)
In-Reply-To <mailman.416.1357943251.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=98.217.186.206; posting-account=w-5w_goAAADUIOLQGYHG22ns_QlDow8P
References <1eb7cd76-ade3-4c34-8816-6eaa7201262e@googlegroups.com> <mailman.416.1357943251.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 98.217.186.206
MIME-Version 1.0
Subject Re: Problem with importing in Python
From su29090 <129km09@gmail.com>
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Message-ID <mailman.418.1357943914.2939.python-list@python.org> (permalink)
Lines 50
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357943914 news.xs4all.nl 6885 [2001:888:2000:d::a6]:33802
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36653

Show key headers only | 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