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


Groups > comp.lang.python > #18491

Re: import issue with classes

From Terry Reedy <tjreedy@udel.edu>
Subject Re: import issue with classes
Date 2012-01-04 02:03 -0500
References <CABRP1o9vGVQLQ0GE41S5kuXW1DLroKYtkvZN-VH9C73CTR46Ug@mail.gmail.com> <4F03C24F.9010703@gmail.com> <je0jkr$lr9$1@dough.gmane.org>
Newsgroups comp.lang.python
Message-ID <mailman.4406.1325660615.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 1/3/2012 11:13 PM, Terry Reedy wrote:
> 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

why it *is* recommended (to have different names) and not recommended to 
have the same name, including case.

> 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-04 02:03 -0500

csiph-web