[Pythonmac-SIG] py2app = newbie path confusion

Daniel Lord daniellord at mac.com
Wed Apr 19 17:18:05 CEST 2006


On Apr 19, 2006, at 6:38, corporate user wrote:

> Many thanks to you Bob.
> You're a community treasure.
>
>
>> Also note that the Image module probably isn't broken (don't have
>> PIL installed at the moment, can't check).  Constants don't
>> automagically just insert themselves into your script.  You should
>> be able to reference it with Image.BICUBIC.
>
> yes, referencing Image.BICUBIC works correctly.
>
> As usual my problems lie with the scope. I'm forming the opinion that
> "from XXX import *" should be banned from all introduction, tutorial
> and example materials. It encourages naive assumptions about things
> automagically inserting themselves into your namespace. Everything
> seems simple when following the examples. But when you try
> paraphrasing them for your own work, it blows up in your face.
>
> It would be better to provide beginners an understanding of
> namespaces from the start.

Most Python books do cover namespaces in the early chapters (at least  
the ones I read ;-). But 'from xxx import *' makes it too easy to  
forget them since it mashes the namespaces together. I've rarely  
encountered collisions but I try not to be that lazy. I try to use  
'import xxxx' and prefix the module name as often as practical fro  
that reason. Of course the downside is that if the module name or  
path structure internally change one has a lot of string subs to do  
in the source. TANSTAAFL. 


More information about the Pythonmac-SIG mailing list