Re: [Tutor] Importing Modules Within Classes

2005-10-07 Thread Bill Campbell
On Fri, Oct 07, 2005, Kent Johnson wrote: >Pierre Barbier de Reuille wrote: >> (never import >> a module in a small function likely to be called in an inner-loop !) > >That's good advice, but I would say "in a *time-critical* inner-loop". After >the first import, importing a module is fast, it is

Re: [Tutor] Importing Modules Within Classes

2005-10-07 Thread Kent Johnson
Pierre Barbier de Reuille wrote: > (never import > a module in a small function likely to be called in an inner-loop !) That's good advice, but I would say "in a *time-critical* inner-loop". After the first import, importing a module is fast, it is just a few dictionary lookups (looking up the m

Re: [Tutor] Importing Modules Within Classes

2005-10-07 Thread Pierre Barbier de Reuille
Kent Johnson a écrit : > Daniel Watkins wrote: > >[...] > >>However, someone (I don't recall who) said that there were occasions >>when it would be appropriate to import modules the former way. I was >>just wondering under what circumstances importing should be done this >>way? > > > That was

Re: [Tutor] Importing Modules Within Classes

2005-10-07 Thread Eric Walker
That was me using the import within the class. I only did it due to my ignorance. I am not advanced enough to use it like that and know what I am doing, so as suggested I just moved all of my imports to the top. Python Newbie. On Thursday 06 October 2005 08:21 pm, Kent Johnson wrote: > Danie

Re: [Tutor] Importing Modules Within Classes

2005-10-06 Thread Kent Johnson
Daniel Watkins wrote: > Recently, there has been an example of someone importing modules within > a class definition. eg: > > class Exemplar: > import re > ...use re... > > It seems obvious to me that this is incorrect, though more through > training than actual observation on my part

[Tutor] Importing Modules Within Classes

2005-10-06 Thread Daniel Watkins
Recently, there has been an example of someone importing modules within a class definition. eg: class Exemplar: import re ...use re... It seems obvious to me that this is incorrect, though more through training than actual observation on my part, and it should be: import re clas