[Tutor] A slight bug in IDLE

Dave Angel davea at davea.name
Sun Jul 14 01:45:57 CEST 2013


On 07/13/2013 07:29 PM, Jim Mooney wrote:
> Dave Angel <davea at davea.name>
>
> You still don't understand.  If you write a module and I import it, then
>> other imports BY ME don't affect your module. Whether it's a __future__ one
>> or not.  My import affects my global namespace, not yours.  My compile-time
>> switches affect my divide, not yours.  Same thing.
>>
>
> Ah, clarity. This namespace stuff is cool, but it takes getting used to.
> However, it makes perfect sense that I never want to alter the original
> intent of the programmer of the module I'm importing, by clobbering his
> names.
>
> Where I got confused is I'm importing a module with a manual input, then
> renaming the input function to a generator function in my program , so I
> can bypass manual input and feed the module tons of data. That works fine,
> but I didn't follow how the imported module code could see that it should
> go to my generator function instead of the manual input function, unless I
> was changing the imported module in some way. But it's now clear I'm not.
>
I really couldn't follow that paragraph.  What's a manual input?  What 
do you mean renaming the input function (you mean the input statement?) 
to a generator function?  Perhaps this would better be a new thread you 
should start.

> Which  brings up a question. I  finally settled on Python 2.7 for various
> reasons, but find some 3.3 things useful. Generators are one-off and input
> is one-off, so they match well for testing, for instance. I checked the
> docs and I don't see many __future__ imports. Are these all there are, or
> are there other useful ones that are better hidden?  -  nested_scopes,
> generators, division, absolute_import, with_statement print_function
> unicode_literals
>
> I'm not importing them all, just what seems useful to me at this point, and
> renaming raw_input, so my 2.7 is kind of 3.3ish. But is there anything I
> missed or any problems I'm unaware of in what will be my standard header,
> below?
>
> #Using Python 2.7 on Win 7
> from __future__ import generators, division, with_statement, print_function
> import sys
> if int(sys.version[0]) < 3: input = raw_input
>
> Jim
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>


-- 
DaveA



More information about the Tutor mailing list