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
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
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,
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()
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
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
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
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
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
Hi
Is there a lib or code example for merging 2 sound files( wav or mp3 )
Thanks
Wen
--
http://mail.python.org/mailman/listinfo/python-list
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. :)
1 import threading
2
3 def synchronized(func):
4 def innerMethod(self, *args,
One measurement by which Python is more popular than Ruby, Java, Perl,
PHP and .NET is in the world of Podcasts. At Podcastalley, podcasts are
ranked by popularity in each of several genre's. In the "Technology"
genre there are 1026 podcasts listed and ranked, and of the ones that
are about program
George Sakkis wrote:
> "Jason" <[EMAIL PROTECTED]> wrote:
>
>> What I'd like to know is do you think it would be better to sort the
>> list in memory, or print it out sorted? If the latter, then naturally
>> I'd need to change the showScores section to show the list in a reverse
>> order. But, w
If you are looking for something pythonic, full featured and very easy
to use, you should check this out: http://karrigell.sourceforge.net
Give it a try and let me know how it goes...
Cheers,
Luis
--
http://mail.python.org/mailman/listinfo/python-list
Not allowed to use Beautiful Soup because of the very important built
ins that is provides that makes it very simple to complete this
problem. Not my choice . This is a review question for our final in two
months and I just want to get things going so I can try to understand
things better. Please h
"George" <[EMAIL PROTECTED]> wrote:
> Hello everyone I know many have helped but I cannot get this to work
> out correctly. I cannot use BeautifulSoup at all. I need to:
> [snipped]
What do you mean you cannot use BeautifulSoup ? You cannot download it, install
it, import it, or
you are not allo
"Jason" <[EMAIL PROTECTED]> wrote:
> What I'd like to know is do you think it would be better to sort the
> list in memory, or print it out sorted? If the latter, then naturally
> I'd need to change the showScores section to show the list in a reverse
> order. But, would sorting the list in memo
"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_newlines=True, bufsize=1)
>> > os
[George Sakkis]
> Yes, py.test: http://codespeak.net/py/current/doc/test.html.
The whole http://codespeak.net site contains many interesting projects,
which are all worth a good look!
However, there is a generic ``LICENSE`` file claiming copyrights on all
files, without explaining what the copyr
[D H]
> I think it means you should fuck off, asshole.
Such language looks very inappropriate to me in a public list, and
builds a bad and long-lasting prejudice against those resorting to it.
Flamers should rather, for their own image, email each other privately
on their matters (yet D.H. is not
"paul kölle" <[EMAIL PROTECTED]> wrote:
>
> [snipped]
>
> It seems to me my case is not that exotic, I thought it would be quite
> natural to write the boilerplate stuff in setUp() and build on that to
> step through the applications state with test* methods each building on
> top of each other. Is
Honestly I am not knowledgeable about either option but mainly I was
specifically targetting my feature set towards the things that a higher
level game engine would need such as the one described here:
http://harkal.sylphis3d.com/2005/08/10/multithreaded-game-scripting-with-stackless-python/
Which
"Ivan Shevanski" <[EMAIL PROTECTED]> wrote:
> Alright heres my problem. . .Say I want to carry over a variable from one
> function to another or even another run of the same function. Is that
> possible?
You want one of two things.
The most obvious would be a global variable. Something like th
Alright heres my problem. . .Say I want to carry over a variable from one
function to another or even another run of the same function. Is that
possible? Heres a quick example of what I'm talking about.
def abc():
x = 1
y = x + 1
print y
def abcd():
y = x + 1
print y
abc()
abcd
Hello everyone I know many have helped but I cannot get this to work
out correctly. I cannot use BeautifulSoup at all. I need to:
Parse the HTML and extracting all the links, convert them to IP
addresses, and build a list of all these IP addresses, thwn I need to
sort the list and remove the dupl
Grant Edwards wrote:
> On 2005-09-25, D H <[EMAIL PROTECTED]> wrote:
>
>
I would recommend emailing the author of a library when you
have a question about that library. You should know that
yourself as well.
>>>
>>>Why??
>>
>>Please tell me I don't have to explain to you why the auth
Paul Boddie:
> Regardless of anyone's alleged connection with Boo or newsgroup
> participation level, the advice to contact the package
> author/maintainer is sound. It happens every now and again that people
> post questions to comp.lang.python about fairly specific issues or
> packages that woul
Eyual> What is the fastest way to find out a host is alive should i make
Eyual> a sys call and ping or is thier an easier way What is the fastest
Eyual> way to find out a host is alive should i make a sys call and ping
Eyual> or is thier an easier way
Depends on the meaning of "ho
Tom, best explanation yet! Entertaining as well as educational.
The "%05i" trick is very neat, must remember that one!
Everything working a charm apart from the viewScores is still returning
the results from the lowest score (at the top) to the highest score.
What I'd like to know is do you th
What is the fastest way to find out a host is alive should i make a sys call and ping or is thier an easier way
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-09-25, D H <[EMAIL PROTECTED]> wrote:
>>>I would recommend emailing the author of a library when you
>>>have a question about that library. You should know that
>>>yourself as well.
>>
>> Why??
>
> Please tell me I don't have to explain to you why the author
> of a 3rd party library migh
Fredrik Lundh wrote:
> Paul Boddie wrote:
>
>
>>Regardless of anyone's alleged connection with Boo or newsgroup
>>participation level, the advice to contact the package
>>author/maintainer is sound. It happens every now and again that people
>>post questions to comp.lang.python about fairly speci
Grant Edwards wrote:
> On 2005-09-25, D H <[EMAIL PROTECTED]> wrote:
>
Igor V. Rafienko wrote:
>This gave me the desired behaviour, but:
>
>* It looks *very* ugly
>* It's twice as slow as version which sees 'end'-events only.
>
>Now, there *has* to be a better
On Sun, 25 Sep 2005, Jason wrote:
> A week ago I posted a simple little hi-score routine that I was using to
> learn Python.
>
> I've only just managed to examine the code, and the responses that people
> gave, and I'm now seriously struggling to understand why things aren't
> working correctly
Peter wrote:
> Peter wrote:
>
>> Jason wrote:
>>
>>
>>
>>> A week ago I posted a simple little hi-score routine that I was
>>> using to learn Python.
>>>
>>> I've only just managed to examine the code, and the responses that
>>> people gave, and I'm now seriously struggling to understand why
Reinhold Birkenfeld wrote:
> Jason wrote:
>> Rather than reply to those individuals, just a big "thanks" to those
>> that have helped.
>>
>> It's definitely making sense, the fact that I need to show the
>> two-element tuple to show correctly was one of those head-slapping moments.
>>
>> And Denn
Christoph Haas napisał(a):
> Since I don't know which plugins have been put into that directory
> I cannot just "import Plugin1, Plugin2, Plugin3" in the "__init__.py".
> So I need to find out the *.py there and load them during startup.
> I could do that with a "walk" over that directory.
See en
Line 13:17 of OpenGL.__init__.py, replace with:
try:
filename = os.path.join(os.path.dirname(__file__), 'version')
__version__ = string.strip(open(filename).read())
except Exception, err:
__version__ = '2.0.2.02'
HTH,
Mike
[EMAIL PROTECTED] wrote:
>I am using the new py2exe and python 24. When
Jason wrote:
> Rather than reply to those individuals, just a big "thanks" to those
> that have helped.
>
> It's definitely making sense, the fact that I need to show the
> two-element tuple to show correctly was one of those head-slapping moments.
>
> And Dennis Lee Bieber hit the nail on the
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 these modules loaded
dynamically. Users can put th
Duncan Booth wrote:
>Jason wrote:
>
>
>
>>My first problem (lack of understanding of course) is that if I run the
>>above, I get an error saying:
>>
>> print "%s - %s" % name,score
>>TypeError: not enough arguments for format string
>>
>>Now I understand what it's saying, but I don't unders
Rather than reply to those individuals, just a big "thanks" to those
that have helped.
It's definitely making sense, the fact that I need to show the
two-element tuple to show correctly was one of those head-slapping moments.
And Dennis Lee Bieber hit the nail on the head when he mentioned that
I'm into *real* purity. I would rather begin every script:
from python import list, str, dict, sys, os
Oh wait. I only use dict in less than 50% of my scripts:
from python import list, str, sys, os
That's better.
On Saturday 03 September 2005 02:09, tiissa wrote:
> I was just stating you
On Sun, 25 Sep 2005, Catalin Marinas wrote:
> Sorry if this was previously discussed but it's something I miss in
> Python. I get around this using isinstance() but it would be cleaner to
> have separate functions with the same name but different argument types.
> I think the idea gets quite cl
Thank you all!
After all, I found at least three more or less convenient alternatives:
1) Pass X as default parameter to F.
2) Set globals() from inside A, something like globals()['A_locals'] =
locals() or globals()['A_X'] = X. Then access A_locals or A_X from F.
3) Use sys._getframe(1) or sys._
Peter wrote:
>Jason wrote:
>
>
>
>>A week ago I posted a simple little hi-score routine that I was using to
>>learn Python.
>>
>>I've only just managed to examine the code, and the responses that
>>people gave, and I'm now seriously struggling to understand why things
>>aren't working correct
Just a little addendum... this lag only happens when the output is a
very long continuous string. If I print out 3000 or so LINES of output
there's no problem, its only when it's one long continuous string.
--
http://mail.python.org/mailman/listinfo/python-list
Paul Boddie wrote:
> Regardless of anyone's alleged connection with Boo or newsgroup
> participation level, the advice to contact the package
> author/maintainer is sound. It happens every now and again that people
> post questions to comp.lang.python about fairly specific issues or
> packages tha
Rainer Hubovsky wrote:
> Hello Python-Gurus,
>
> ==
> f = open(LOGFILE,'w')
> f.write(time + '\n')
> f.close
>
> command = 'ping -n 20' + target + '>>' + LOGFILE
> system(command)
> ==
>
> produces an error saying that a file cannot be accessed bec
Hello Python-Gurus,
==
f = open(LOGFILE,'w')
f.write(time + '\n')
f.close
command = 'ping -n 20' + target + '>>' + LOGFILE
system(command)
==
produces an error saying that a file cannot be accessed because it is used
by another process. I asume it
Diez B. Roggisch wrote:
> paul kölle wrote:
>
>>hi all,
>>
>>I noticed that setUp() and tearDown() is run before and after *earch*
>>test* method in my TestCase subclasses. I'd like to run them *once* for
>>each TestCase subclass. How do I do that.
>
>
> Create a global/test instance flag.
I'm
On 2005-09-25, D H <[EMAIL PROTECTED]> wrote:
>>>Igor V. Rafienko wrote:
>>>
This gave me the desired behaviour, but:
* It looks *very* ugly
* It's twice as slow as version which sees 'end'-events only.
Now, there *has* to be a better way. What am I missing?
>>>
>>>Try ema
Paul Boddie wrote:
> Reinhold Birkenfeld wrote:
>> D H wrote:
>> > I would recommend emailing the author of a library when you have a
>> > question about that library. You should know that yourself as well.
>>
>> Well, if I had e.g. a question about Boo, I would of course first ask
>> here because
Jason wrote:
>A week ago I posted a simple little hi-score routine that I was using to
>learn Python.
>
>I've only just managed to examine the code, and the responses that
>people gave, and I'm now seriously struggling to understand why things
>aren't working correctly.
>
>At present my code is
Reinhold Birkenfeld wrote:
> D H wrote:
> > I would recommend emailing the author of a library when you have a
> > question about that library. You should know that yourself as well.
>
> Well, if I had e.g. a question about Boo, I would of course first ask
> here because I know the expert writes h
Igor V. Rafienko wrote:
> The problem is that the file looks like this:
>
>
... lots of schnappi records ...
okay. I think your first approach
from cElementTree import iterparse
for event, elem in iterparse("data.xml"):
if elem.tag == "schnappi":
count += 1
Fredrik Lundh wrote:
> Doug Holton wrote:
>
>
>>You're the only one making any association between this thread about
>>celementree and boo.
>
>
> really? judging from the Original-From header in your posts, your internet
> provider is sure making the same association...
You seriously need som
Hey everyone, just a quick general question about using the main python
shell (I'm using IDLE on Windows to be exact).
Whenever I print some really long output to the screen (> 3000
characters or so), my shell will start lagging very badly. I'm not
sure if the shell keeps some memory dedicated to
Steven D'Aprano wrote:
> py> class Klass:
> ... pass
> ...
> py> def eggs(self, x):
> ... print "eggs * %s" % x
> ...
> py> inst = Klass() # Create a class instance.
> py> inst.eggs = eggs # Dynamically add a function/method.
> py> inst.eggs(1)
> Traceback (most recent call last):
> Fil
Steven Bethard wrote:
> > Using the following snippet:
> > p =
> > subprocess.Popen(nmake,stderr=subprocess.PIPE,stdout=subprocess.PIPE, \
> >universal_newlines=True, bufsize=1)
> > os.sys.stdout.writelines(p.stdout)
> > os.sys.stdout.writelines(p.stderr)
> > Works
[ Fredrik Lundh ]
[ ... ]
> the iterparse/clear approach works best if your XML file has a
> record-like structure. if you have toplevel records with lots of
> schnappi records in them, iterate over the records and use find
> (etc) to locate the subrecords you're interested in: (...)
The proble
Doug Holton wrote:
> You're the only one making any association between this thread about
> celementree and boo.
really? judging from the Original-From header in your posts, your internet
provider is sure making the same association...
--
http://mail.python.org/mailman/listinfo/python-list
Uri Nix wrote:
> Using the following snippet:
> p =
> subprocess.Popen(nmake,stderr=subprocess.PIPE,stdout=subprocess.PIPE, \
>universal_newlines=True, bufsize=1)
> os.sys.stdout.writelines(p.stdout)
> os.sys.stdout.writelines(p.stderr)
> Works fine on the command li
Reinhold Birkenfeld wrote:
> D H wrote:
>
>>Reinhold Birkenfeld wrote:
>>
>>>D H wrote:
>>>
>>>
D H wrote:
>Reinhold Birkenfeld wrote:
>
>
>
>>Well, if I had e.g. a question about Boo, I would of course first ask
>>here because I know the expert writes here.
>
Igor V. Rafienko wrote:
> Finally, I thought about keeping track of when to clear and when not
> to by subscribing to start and end elements (so that I would collect
> the entire -subtree in memory and only than release it):
>
> from cElementTree import iterparse
> clear_flag = True
> for event, e
D H wrote:
> Reinhold Birkenfeld wrote:
>> D H wrote:
>>
>>>D H wrote:
>>>
Reinhold Birkenfeld wrote:
>Well, if I had e.g. a question about Boo, I would of course first ask
>here because I know the expert writes here.
>
>Reinhold
Reinhold Birkenfeld also
Reinhold Birkenfeld wrote:
> D H wrote:
>
>>D H wrote:
>>
>>>Reinhold Birkenfeld wrote:
>>>
>>>
Well, if I had e.g. a question about Boo, I would of course first ask
here because I know the expert writes here.
Reinhold
>>>
>>>
>>>Reinhold Birkenfeld also wrote:
>>> > If I had want
Jason wrote:
> My first problem (lack of understanding of course) is that if I run the
> above, I get an error saying:
>
> print "%s - %s" % name,score
> TypeError: not enough arguments for format string
>
> Now I understand what it's saying, but I don't understand why.
>
The problem is
Hi also !
In other fields, I also found uses which did not function with subprocess,
but OK with popen2/4
@-salutations
Michel Claveau
--
http://mail.python.org/mailman/listinfo/python-list
Jason wrote:
> A week ago I posted a simple little hi-score routine that I was using to
> learn Python.
>
> I've only just managed to examine the code, and the responses that
> people gave, and I'm now seriously struggling to understand why things
> aren't working correctly.
>
> At present my
D H wrote:
> D H wrote:
>> Reinhold Birkenfeld wrote:
>>
>>>
>>> Well, if I had e.g. a question about Boo, I would of course first ask
>>> here because I know the expert writes here.
>>>
>>> Reinhold
>>
>>
>> Reinhold Birkenfeld also wrote:
>> > If I had wanted to say "you have opinions? fuck o
D H wrote:
> Reinhold Birkenfeld wrote:
>
>>
>> Well, if I had e.g. a question about Boo, I would of course first ask
>> here because I know the expert writes here.
>>
>> Reinhold
>
> Reinhold Birkenfeld also wrote:
> > If I had wanted to say "you have opinions? fuck off!", I would have said
>
A week ago I posted a simple little hi-score routine that I was using to
learn Python.
I've only just managed to examine the code, and the responses that
people gave, and I'm now seriously struggling to understand why things
aren't working correctly.
At present my code is as follows...
import
D H wrote:
> Reinhold Birkenfeld wrote:
>
>>
>> Well, if I had e.g. a question about Boo, I would of course first ask
>> here because I know the expert writes here.
>>
>> Reinhold
>
>
> Reinhold Birkenfeld also wrote:
> > If I had wanted to say "you have opinions? fuck off!", I would have said
On Sun, 25 Sep 2005 14:52:56 +, Ron Adam wrote:
> Steven D'Aprano wrote:
>
>
>> Or you could put the method in the class and have all instances recognise
>> it:
>>
>> py> C.eggs = new.instancemethod(eggs, None, C)
>> py> C().eggs(3)
>> eggs * 3
>
> Why not just add it to the class directly
Reinhold Birkenfeld wrote:
>
> Well, if I had e.g. a question about Boo, I would of course first ask
> here because I know the expert writes here.
>
> Reinhold
Reinhold Birkenfeld also wrote:
> If I had wanted to say "you have opinions? fuck off!", I would have said
>"you have opinions? fuck
D H wrote:
> Reinhold Birkenfeld wrote:
>> D H wrote:
>>
>>>Igor V. Rafienko wrote:
>>>
This gave me the desired behaviour, but:
* It looks *very* ugly
* It's twice as slow as version which sees 'end'-events only.
Now, there *has* to be a better way. What am I missing?
>>
Reinhold Birkenfeld wrote:
> D H wrote:
>
>>Igor V. Rafienko wrote:
>>
>>>This gave me the desired behaviour, but:
>>>
>>>* It looks *very* ugly
>>>* It's twice as slow as version which sees 'end'-events only.
>>>
>>>Now, there *has* to be a better way. What am I missing?
>>>
>>
>>Try emailing the
D H wrote:
> Igor V. Rafienko wrote:
>> This gave me the desired behaviour, but:
>>
>> * It looks *very* ugly
>> * It's twice as slow as version which sees 'end'-events only.
>>
>> Now, there *has* to be a better way. What am I missing?
>>
>
> Try emailing the author for support.
I don't think
Igor V. Rafienko wrote:
> This gave me the desired behaviour, but:
>
> * It looks *very* ugly
> * It's twice as slow as version which sees 'end'-events only.
>
> Now, there *has* to be a better way. What am I missing?
>
Try emailing the author for support.
--
http://mail.python.org/mailman/lis
Hi,
I am trying to understand how cElementTree's clear works: I have a
(relatively) large XML file, that I do not wish to load into memory.
So, naturally, I tried something like this:
from cElementTree import iterparse
for event, elem in iterparse("data.xml"):
if elem.tag == "schnappi":
Here's a suggestion for you:
Check out the comp.lang.py thread titled "Catching stderr output from
graphical apps" at
> http://groups.google.com/group/comp.lang.python/browse_frm/thread/1d63e12e15ca528b/7bf604115b5e914e#7bf604115b5e914e
I strongly suspect that the code discussed could probably be
Fredrik Lundh wrote:
>("sanitizing" HTML data by running filters over encoded 8-bit data is hardly
>ever the right thing to do...)
>
>
>
>
I'm very much open to suggestions as to the right way to do this. I'm
working on this primarily as a learning project and security is my
motivation for wa
Stefan Behnel wrote:
> Hi!
>
> I was looking for an implementation of a parser/model/serializer for Content
> MathML in Python. Does anyone know about something useful?
>
> I need to work with math expressions (arithmetic/bool), especially converting
> them between different representations (Pyth
Michael Spencer wrote:
> All is explained at:
> http://users.rcn.com/python/download/Descriptor.htm#functions-and-methods
> and further at:
> http://www.python.org/pycon/2005/papers/36/pyc05_bla_dp.pdf
>
> "For objects, the machinery is in object.__getattribute__ which
> transforms b.x into type
Hi!
I was looking for an implementation of a parser/model/serializer for Content
MathML in Python. Does anyone know about something useful?
I need to work with math expressions (arithmetic/bool), especially converting
them between different representations (Python, SQL), determining dependencies
I am using the new py2exe and python 24. When I run my setup.py, the
dist seems to generate just fine. However run I run the resulting exe,
I get an error:
IOError: [Errno 2] No such file or directory
'c:\\app\\dist\\library.zip\\OpenGL\\version'
Now I've tried the recommended route with older py
paul kölle wrote:
> hi all,
>
> I noticed that setUp() and tearDown() is run before and after *earch*
> test* method in my TestCase subclasses. I'd like to run them *once* for
> each TestCase subclass. How do I do that.
Create a global/test instance flag.
Diez
--
http://mail.python.org/mailman/
Leo Jay <[EMAIL PROTECTED]> writes:
[...]
> I opened the `hjparser.exe' file in UltraEdit(a hex editor), and found
> some partial statements and comments but not complete.
>
> so, my problem is i'm sure that the source code is in `hjparser.exe'
> but i don't know how to decompile the executable fi
On Sun, 25 Sep 2005 15:24:29 +0200, Gerrit Holl wrote
(in article <[EMAIL PROTECTED]>):
> I like this. However, perhaps other people reading my source code won't
> like it, because when they see 'class Foo:', they might expect an
> old-style class. But it's so much better to type and to read, that
Steven D'Aprano wrote:
> Or you could put the method in the class and have all instances recognise
> it:
>
> py> C.eggs = new.instancemethod(eggs, None, C)
> py> C().eggs(3)
> eggs * 3
Why not just add it to the class directly? You just have to be sure
it's a class and not an instance of a cl
"Gerard Flanagan" <[EMAIL PROTECTED]> writes:
[...]
> class FibonacciMatrix:
[...]
> def Copy( self ):
[...]
__copy__ would be a more standard name. Then:
import copy
fm = FibonacciMatrix()
fm2 = copy.copy(fm)
I suppose you could also add:
__deepcopy__ = __copy__
in the body of the clas
Jaroslaw Zabiello wrote:
> Dnia 24 Sep 2005 22:48:40 -0700, [EMAIL PROTECTED] napisał(a):
>
>
>>You should give TurboGears a try.
>
> This project is good only for fun and playing not for enterprise.
That's my kind of project :)
--
http://mail.python.org/mailman/listinfo/python-list
Jon Monteleone wrote:
> What I dont understand about daemonizing a python script is whether or not it
> requires the
> daemon creation, ie the signal handling and forking of the process, to be
> part of the
> daemon code or is this code in a separate program that acts like a wrapper to
> turn a
Hi all,
I've been trying to use (Python 2.4 on WinXP) the subprocess module to
execute a shell command (nmake in this case), and pass its output to a
higher level.
Using the following snippet:
p =
subprocess.Popen(nmake,stderr=subprocess.PIPE,stdout=subprocess.PIPE, \
u
Diez B. Roggisch wrote:
> > What is the reason for allowing both styles? (backwards compatibility??)
>
> yes.
Note that there is another way to create new-style classes:
__metaclass__ = type
before the first class definition:
>>> class Foo: pass
...
>>> type(Foo)
>>> __metaclass__ = type
>>>
Catalin Marinas wrote:
> Sorry if this was previously discussed but it's something I miss in
> Python. I get around this using isinstance() but it would be cleaner
> to have separate functions with the same name but different argument
> types. I think the idea gets quite close to the Lisp/CLOS
> im
Tarek Ziadé wrote:
> Hi list,
>
> I am trying to find a general memory profiler that can measure the
> memory usage in Python program
> and gather some stats about object usages, and things like that.
>
> I am trying to find a simple python module to be able to customize it
> and integrates it to
hi all,
I noticed that setUp() and tearDown() is run before and after *earch*
test* method in my TestCase subclasses. I'd like to run them *once* for
each TestCase subclass. How do I do that.
thanks
paul
--
http://mail.python.org/mailman/listinfo/python-list
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> google for gnosis utils and multimethods to see a more "oldfashioned"
> implementation.
I now remember to have seen it but it requires a lot of typing to
achieve it and you would call a different function name from the one
you define, reducing the co
1 - 100 of 109 matches
Mail list logo