Re: module imports and st_mtime

2009-11-10 Thread Aahz
In article , tow wrote: > >Does anyone have any ideas what might be going on, or where further to >look? I'm at a bit of a loss. Try asking on pythonmac-...@python.org -- Aahz (a...@pythoncraft.com) <*> http://www.pythoncraft.com/ [on old computer technologies and programmers

Re: module imports and st_mtime

2009-11-04 Thread Carl Banks
On Nov 4, 4:08 pm, tow wrote: > Does anyone have any ideas what might be going on, or where further to > look? I'm at a bit of a loss. Does Mac OS have a concept of process-local filesystem modification? I.e. when loading the library does it create a process-local copy of the file with an updated

Re: Module imports during object instantiation

2007-08-16 Thread Ritesh Raj Sarraf
Steve Holden wrote: > Ritesh Raj Sarraf wrote: >> On Aug 16, 12:16 am, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: >>> On Aug 15, 11:42 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >>> > [...] >> Oops!!! Looks like I completely missed this. It _did_ print the error >> message. >> Apologies to all

Re: Module imports during object instantiation

2007-08-15 Thread Steve Holden
Ritesh Raj Sarraf wrote: > On Aug 16, 12:16 am, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: >> On Aug 15, 11:42 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: >> [...] > Oops!!! Looks like I completely missed this. It _did_ print the error > message. > Apologies to all for not keeping a close eye on

Re: Module imports during object instantiation

2007-08-15 Thread Ritesh Raj Sarraf
On Aug 16, 12:16 am, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > On Aug 15, 11:42 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > > > On 2007-08-15, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > > > Or am I terribly missing something that you are trying to tell ? > > > I didn't see log = Log() in

Re: Module imports during object instantiation

2007-08-15 Thread Ritesh Raj Sarraf
On Aug 15, 11:42 pm, Neil Cerutti <[EMAIL PROTECTED]> wrote: > On 2007-08-15, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > > Or am I terribly missing something that you are trying to tell ? > > I didn't see log = Log() in your example. Sorry for the > excursion. > > Are you sure os.name is 'posix

Re: Module imports during object instantiation

2007-08-15 Thread Neil Cerutti
On 2007-08-15, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > >>> >>> Doesn't __init__ get called automatically ? >> >> It gets called automatically when you construct an instance of >> the class in which it's defined. > > I am a little confused by your statements now. > > In

Re: Module imports during object instantiation

2007-08-15 Thread Ritesh Raj Sarraf
Neil Cerutti wrote: >> >> Doesn't __init__ get called automatically ? > > It gets called automatically when you construct an instance of > the class in which it's defined. I am a little confused by your statements now. In my earlier posts in the same thread, I gave some code example which was s

Re: Module imports during object instantiation

2007-08-14 Thread Neil Cerutti
On 2007-08-14, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > >> If you want an import inside an __init__ to run, you must call >> the __init__ function that contains it. > > Doesn't __init__ get called automatically ? It gets called automatically when you construct an instan

Re: Module imports during object instantiation

2007-08-14 Thread Ritesh Raj Sarraf
Neil Cerutti wrote: > If you want an import inside an __init__ to run, you must call > the __init__ function that contains it. Doesn't __init__ get called automatically ? I thought __init__ was required to be called explicitly only when you were doing inheritance and wanted to pass separate value

Re: Module imports during object instantiation

2007-08-14 Thread Neil Cerutti
On 2007-08-14, Ritesh Raj Sarraf <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: > What's leading you to conclude the import isn't being executed? You realise, I trust, that the module's code will only be executed on the first call to __init__()? >>> >>> Well. Putting i

Re: Module imports during object instantiation

2007-08-14 Thread Ritesh Raj Sarraf
Bruno Desthuilliers wrote: >>> What's leading you to conclude the import isn't being executed? You >>> realise, I trust, that the module's code will only be executed on the >>> first call to __init__()? >>> >> >> Well. Putting it in a "try" inside __init__() doesn't do anything. > > This would b

Re: Module imports during object instantiation

2007-08-14 Thread Bruno Desthuilliers
Ritesh Raj Sarraf a écrit : > Steve Holden wrote: (snip) >> What's leading you to conclude the import isn't being executed? You >> realise, I trust, that the module's code will only be executed on the >> first call to __init__()? >> > > Well. Putting it in a "try" inside __init__() doesn't do an

Re: Module imports during object instantiation

2007-08-14 Thread Bruno Desthuilliers
Ritesh Raj Sarraf a écrit : > Bruno Desthuilliers wrote: > >> Ritesh Raj Sarraf a écrit : >>> if lock is None or lock != 1: >>> self.DispLock = False >>> else: >>> self.DispLock = threading.Lock() >>> self.lock = True >>> >>> if os.name =

Re: Module imports during object instantiation

2007-08-14 Thread Bruno Desthuilliers
Ritesh Raj Sarraf a écrit : > Bruno Desthuilliers wrote: > >> Ritesh Raj Sarraf a écrit : >> >> The initializer will be called *each time* you instanciate the class. >> And nothing prevents client code from calling it explicitelly as many >> times as it wants - ok, this would be rather strange, b

Re: Module imports during object instantiation

2007-08-13 Thread Ritesh Raj Sarraf
Steve Holden wrote: > Ritesh Raj Sarraf wrote: >> class Log: >> >> def __init__(self, verbose, lock = None): >> >> if verbose is True: >> self.VERBOSE = True >> else: self.VERBOSE = False >> > Better: > > self.VERBOSE = verbose > > or, if you suspect verbose mi

Re: Module imports during object instantiation

2007-08-13 Thread Ritesh Raj Sarraf
Bruno Desthuilliers wrote: > Ritesh Raj Sarraf a écrit : > > The initializer will be called *each time* you instanciate the class. > And nothing prevents client code from calling it explicitelly as many > times as it wants - ok, this would be rather strange, but this is still > technically possi

Re: Module imports during object instantiation

2007-08-13 Thread Ritesh Raj Sarraf
Bruno Desthuilliers wrote: > Ritesh Raj Sarraf a écrit : >> >> if lock is None or lock != 1: >> self.DispLock = False >> else: >> self.DispLock = threading.Lock() >> self.lock = True >> >> if os.name == 'posix': >>self.platf

Re: Module imports during object instantiation

2007-08-13 Thread Steve Holden
Ritesh Raj Sarraf wrote: > Hi, > > I've been very confused about why this doesn't work. I mean I don't see any > reason why this has been made not to work. > > class Log: > > def __init__(self, verbose, lock = None): > > if verbose is True: > self.VERBOSE = True >

Re: Module imports during object instantiation

2007-08-13 Thread Bruno Desthuilliers
Ritesh Raj Sarraf a écrit : > On Aug 11, 3:17 am, James Stroud <[EMAIL PROTECTED]> wrote: >> You do realize your import statement will only be called for nt and dos >> systems don't you? >> > > Yes. I would like to load a Windows Python Module (which is, say a > specific implementation for Windows

Re: Module imports during object instantiation

2007-08-13 Thread Bruno Desthuilliers
Ritesh Raj Sarraf a écrit : > Hi, > > I've been very confused about why this doesn't work. I mean I don't see any > reason why this has been made not to work. > > class Log: > > def __init__(self, verbose, lock = None): > > if verbose is True: Don't use an identity test here. There

Re: Module imports during object instantiation

2007-08-11 Thread Ritesh Raj Sarraf
On Aug 11, 3:17 am, James Stroud <[EMAIL PROTECTED]> wrote: > You do realize your import statement will only be called for nt and dos > systems don't you? > Yes. I would like to load a Windows Python Module (which is, say a specific implementation for Windows only) in such a condition where I find

Re: Module imports during object instantiation

2007-08-10 Thread James Stroud
Ritesh Raj Sarraf wrote: > Hi, > > I've been very confused about why this doesn't work. I mean I don't see any > reason why this has been made not to work. > > class Log: > > def __init__(self, verbose, lock = None): > > if verbose is True: > self.VERBOSE = True >

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Joshua J. Kugler
On Thursday 24 May 2007 08:32, Steve Holden wrote: > The directory containing the script you are executing is also added to > sys.path. Since you are executing a script called planet ... Ah! That's it. That had never occurred to me, as I was under the impression that your current *working* direct

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Steve Holden
Joshua J. Kugler wrote: > Yes, I've read this: > http://mail.python.org/pipermail/python-list/2006-August/395943.html > That's not my problem. > > I installed PlanetPlanet via the > package's "setup.py install" command (as root). planet.py will not run, > however, g

Re: Module imports fine from interactive, not from script

2007-05-24 Thread Paul Moore
On 23 May, 02:20, "Joshua J. Kugler" <[EMAIL PROTECTED]> wrote: > Yes, I've read > this:http://mail.python.org/pipermail/python-list/2006-August/395943.html > That's not my problem. > > I installed PlanetPlanet via the > package's "setup.py install" command (as root)

Re: Module imports

2006-01-30 Thread Gary Herron
[EMAIL PROTECTED] wrote: >I have written a number of functions and stored them in a file named >myFunctions.py. This keeps all my functions under one roof, and if I >want to use or one or more of them in a program, I can start the >program off with > >from myFunctions import f1,f2 > >Some of these

Re: module imports and memory usage

2004-12-01 Thread Carlos Ribeiro
On Tue, 30 Nov 2004 16:46:43 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote: > I discovered that when I wrap my code up in a function def and call it > that it uses around 4.6 MB of RAM all the time... even while sleeping. > However, when I don't put it in a function def it uses around 2.6MB of > dat

Re: module imports and memory usage

2004-11-30 Thread Brad Tilley
Brad Tilley wrote: When memory usage is a concern, is it better to do: from X import Y or import X Also, is there a way to load and unload modules as they are needed. I have some scripts that sleep for extended periods during a while loop and I need to be as memory friendly as possible. I can pos

Re: module imports and memory usage

2004-11-30 Thread David Bolen
Brad Tilley <[EMAIL PROTECTED]> writes: > When memory usage is a concern, is it better to do: > > from X import Y > > or > > import X Depending on "Y", the latter can technically use less memory, but it's likely to be fairly small and depends on how many symbols from that module you want to ha

Re: module imports and memory usage

2004-11-30 Thread Brad Tilley
Jp Calderone wrote: On Tue, 30 Nov 2004 10:02:27 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote: When memory usage is a concern, is it better to do: from X import Y or import X There is no difference. If you are concerned about memory usage, you probably need to take a look at the data structure

Re: module imports and memory usage

2004-11-30 Thread Jp Calderone
On Tue, 30 Nov 2004 10:02:27 -0500, Brad Tilley <[EMAIL PROTECTED]> wrote: >When memory usage is a concern, is it better to do: > > from X import Y > > or > > import X There is no difference. If you are concerned about memory usage, you probably need to take a look at the data structures ho

Re: module imports and memory usage

2004-11-30 Thread Istvan Albert
Brad Tilley wrote: Also, is there a way to load and unload modules as they are needed. I have some scripts that sleep for extended periods during a while loop and I need to be as memory friendly as possible. I can post a detailed script that currently uses ~ 10MB of memory if anyone is interest