Re: Best practices for dynamically loading plugins at startup

2005-09-25 Thread Jeff Schwab
Christoph Haas wrote: > Dear coders... > > I'm working on an application that is supposed to support "plugins". > The idea is to use the plugins as packages like this: > > Plugins/ > __init__.py > Plugin1.py > Plugin2.py > Plugin3.py > > When the application starts up I want to have thes

Re: Metaclasses, decorators, and synchronization

2005-09-25 Thread Michael Ekstrand
On Sunday 25 September 2005 22:30, Victor Ng wrote: > You could do it with a metaclass, but I think that's probably > overkill. OK. And thanks for the example :-). It looks simple enough... I didn't think the solution would be overly complex. And the RLock makes it easier than I anticipated - wa

Re: Metaclasses, decorators, and synchronization

2005-09-25 Thread Jp Calderone
On Sun, 25 Sep 2005 23:30:21 -0400, Victor Ng <[EMAIL PROTECTED]> wrote: >You could do it with a metaclass, but I think that's probably overkill. > >It's not really efficient as it's doing test/set of an RLock all the >time, but hey - you didn't ask for efficient. :) There's a race condition in t

Re: Metaclasses, decorators, and synchronization

2005-09-25 Thread Victor Ng
Hmmm well that's obvious enough.  This is why I shouldn't write code off the cuff on c.l.p :)OTOH - if I just assign the RLock in the base classes initializer, is there any problem?vic On 9/26/05, Jp Calderone <[EMAIL PROTECTED]> wrote: On Sun, 25 Sep 2005 23:30:21 -0400, Victor Ng <[EMAIL

Re: C#3.0 and lambdas

2005-09-25 Thread Gregory Bond
Mike Meyer wrote: > This is a well-known phenomenon, having picked up the name "bikeshed" > something like 40 years ago. Google for "bikeshed color". My favourite "bikeshed" story: A colleague just joined his local Primary School council. On the agenda for his first meeting was that the shelte

Re: cannot write to file after close()

2005-09-25 Thread Rainer Hubovsky
Thank you Reinhold, that was the solution. But just because I am curious: what is this statement without the parentheses? After all it is a valid statement... Rainer In article <[EMAIL PROTECTED]>, Reinhold Birkenfeld wrote: > Is the above exactly your code? If yes, it should be > > f.close()

Re: cannot write to file after close()

2005-09-25 Thread Fredrik Lundh
Rainer Hubovsky wrote: > Thank you Reinhold, that was the solution. But just because I am curious: > what is this statement without the parentheses? After all it is a valid > statement... it's an expression that fetches the "close" method object, and throws it away. to see what it evaluates to,

Re: subprocess considered harmfull?

2005-09-25 Thread Uri Nix
Roger Upole wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Steven Bethard wrote: > > > >> > Using the following snippet: > >> > p = > >> > subprocess.Popen(nmake,stderr=subprocess.PIPE,stdout=subprocess.PIPE, \ > >> >universal_new

Re: Best practices for dynamically loading plugins at startup

2005-09-25 Thread beza1e1
I wrote this one: -- def load_plugin(self, plugin, paths): import imp # check if we haven't loaded it already try: return sys.modules[plugin] except KeyError: pass # ok, the load it fp, filen

<    1   2