On 8/14/05, Martijn Brouwer <[EMAIL PROTECTED]> wrote:
> After profiling a small python script I found that approximately 50% of
> the runtime of my script was consumed by one line: "import copy".
> Another 15% was the startup of the interpreter, but that is OK for an
> interpreted language. The co
Simon Brunning wrote:
> I think that copy is very rarely used. I don't think I've ever imported it.
>
> Or is it just me?
It's just you. I use copy.deepcopy() fairly often.
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Simon Brunning wrote:
> I think that copy is very rarely used. I don't think I've ever imported it.
>
> Or is it just me?
I rarely use copy, and almost always regret it when I do.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
Simon Brunning wrote:
> On 8/14/05, Martijn Brouwer <[EMAIL PROTECTED]> wrote:
>
>>After profiling a small python script I found that approximately 50% of
>>the runtime of my script was consumed by one line: "import copy".
>>Another 15% was the startup of the interpreter, but that is OK for an
>>
On 8/16/05, Martijn Brouwer <[EMAIL PROTECTED]> wrote:
> Well, I guess making a deep copy of an object is important in many case.
> Just try this:
> A=[]
> B=A
> A.append("foo")
> print B
>
> Guess the output. It is:
> ['foo']
I remember thinking that this behavior was odd when I learned Java
man
Simon Brunning <[EMAIL PROTECTED]> writes:
> I think that copy is very rarely used. I don't think I've ever imported it.
>
> Or is it just me?
Not really. I've used it once that I can recall, to copy a kind of
generic "default value", something like:
def value(self, v, default):
if hasattr(
Michael Hudson wrote:
> Simon Brunning <[EMAIL PROTECTED]> writes:
>
>
>>I think that copy is very rarely used. I don't think I've ever imported it.
>>
>>Or is it just me?
>
>
> Not really. I've used it once that I can recall, to copy a kind of
> generic "default value", something like:
>
> d
On Tue, 16 Aug 2005, Ron Adam wrote:
> Simon Brunning wrote:
>
>> On 8/14/05, Martijn Brouwer <[EMAIL PROTECTED]> wrote:
>>
>>> I can imagine that *a lot* of libs/scripts use the copy library,
>>
>> I think that copy is very rarely used. I don't think I've ever imported it.
>
> I use copy.deepco
[Martijn Brouwer]
> Importing copy takes 5-10 times more time that
> import os, string and re together!
Are you sure you aren't seeing the effects of caching? My little ad hoc test
(which fails on the os module) doesn't confirm your numbers:
$ python2.4 -m timeit -n1 -r1 -s"import sys; assert 're
Tom Anderson wrote:
>
> When you say [:], do you mean that you copy lists like this:
>
> l = someList()
> m = []
> m[:] = l
>
> ?
Why not
m = L[:]
instead of
m = []; m[:] = L
???
>
> That's what i've been doing. The other day, i realised that i could just
> do:
>
> l = someList()
> m = list
Tom Anderson wrote:
> On Tue, 16 Aug 2005, Ron Adam wrote:
>
>
>>Simon Brunning wrote:
>>
>>
>>>On 8/14/05, Martijn Brouwer <[EMAIL PROTECTED]> wrote:
>>>
>>>
I can imagine that *a lot* of libs/scripts use the copy library,
>>>
>>>I think that copy is very rarely used. I don't think I've ever
On Wed, 17 Aug 2005, Steve Holden wrote:
> Tom Anderson wrote:
>
>> On Tue, 16 Aug 2005, Ron Adam wrote:
>>
>>> Simon Brunning wrote:
>>>
On 8/14/05, Martijn Brouwer <[EMAIL PROTECTED]> wrote:
> I can imagine that *a lot* of libs/scripts use the copy library,
I think th
[Martijn Brouwer]
> Importing copy takes 5-10 times more time that
> import os, string and re together!
If your measurement isn't flawed, try again after replacing the following
import in copy.py
try:
from org.python.core import PyStringMap
except ImportError:
PyStringMap = None
with jus
13 matches
Mail list logo