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


Groups > comp.lang.python > #18487

Re: import issue with classes

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'imports': 0.07; 'received:verizon.net': 0.07; 'subject:issue': 0.07; 'terry': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'reedy': 0.16; 'subject:classes': 0.16; 'subject:import': 0.16; 'wrote:': 0.18; 'jan': 0.19; "doesn't": 0.22; 'header:In-Reply-To:1': 0.22; 'module': 0.26; 'thanks.': 0.26; 'import': 0.27; 'variable': 0.28; 'pm,': 0.29; 'class': 0.29; 'confusion': 0.30; 'andrew': 0.32; 'changes': 0.32; 'sort': 0.33; 'header:User-Agent:1': 0.33; 'header:X-Complaints-To:1': 0.33; 'there': 0.33; 'to:addr:python- list': 0.34; 'subject:with': 0.36; 'received:org': 0.38; 'some': 0.38; 'recommended': 0.39; 'why': 0.39; 'called': 0.40; 'to:addr:python.org': 0.40; 'brown': 0.80
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From Terry Reedy <tjreedy@udel.edu>
Subject Re: import issue with classes
Date Tue, 03 Jan 2012 23:13:11 -0500
References <CABRP1o9vGVQLQ0GE41S5kuXW1DLroKYtkvZN-VH9C73CTR46Ug@mail.gmail.com> <4F03C24F.9010703@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding 7bit
X-Gmane-NNTP-Posting-Host pool-74-109-121-73.phlapa.fios.verizon.net
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0
In-Reply-To <4F03C24F.9010703@gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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>
Newsgroups comp.lang.python
Message-ID <mailman.4400.1325650410.27778.python-list@python.org> (permalink)
Lines 15
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1325650410 news.xs4all.nl 6957 [2001:888:2000:d::a6]:57996
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:18487

Show key headers only | View raw


On 1/3/2012 10:06 PM, Andrew Berg wrote:
> On 1/3/2012 8:50 PM, Rodrick Brown wrote:
>> Import FooA doesn't work and I need to use from FooA import FooA
>> instead? This puzzles me.
>> Thanks.
> If you have a module called FooA with a class called FooA, then import
> FooA imports the /module/. The class would be FooA.FooA, just as the
> variable x from FooA would be FooA.x.

This sort of confusion is why it is not recommended to have file/module 
fooa contain class FooA and why there were some module name changes in Py 3.

-- 
Terry Jan Reedy

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


Thread

Re: import issue with classes Terry Reedy <tjreedy@udel.edu> - 2012-01-03 23:13 -0500

csiph-web