On Fri, Jul 3, 2009 at 8:24 PM, Damon Timm wrote:
> And I thought I could just construct something for glob or fnmatch like:
>
> glob.glob("DSC_0065*.jpg") --or-- fnmatch.fnmatch(file, "DSC_0065*.jpg")
Do you have the working directory set to the folder with the jpgs in
it? If not, you have to gi
Dinesh B Vadhia wrote:
I'm suffering from brain failure (or most likely just being brain
less!) and need help to create a list comprehension for this problem:
d is a list of integers: d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11,
1, 6, 3, 5, 6, 11, 1]
Want to create a new list that adds the
Hi - I am trying to find a group of thumbnail files for deletion --
the files all have similar naming structure (though the details vary).
When the main file is deleted, I want all the little ones to go too.
For example, here is a directory listing:
DSC_0063.100.jpg
DSC_0063.100x150.jpg
DSC_0063
On 7/3/2009 4:19 PM Emile van Sebille said...
On 7/3/2009 3:54 PM Dinesh B Vadhia said...
As the lists of integers get larger (mine are in the thousands of
integers per list) the list comprehension solution will get slower.
Do you agree?
Yes, no doubt. Your original post asked only if the
On 7/3/2009 3:54 PM Dinesh B Vadhia said...
Thanks Emile / Kent.
The problem I see with this solution is that at each stage it is
re-summing the j's instead of retaining a running total which the
'for-loop' method does ie.
>>> dd = []
>>> y = d[0]
>>> for i, x in enumerate(d):
>>>
"Dinesh B Vadhia" wrote
As the lists of integers get larger ... the list comprehension
solution will get slower. Do you agree?
Yes thats why Chris said the linear loop solution is almost
certainly faster in this case. However you could speed up
the for loop significantly by missing out th
Thanks Emile / Kent.
The problem I see with this solution is that at each stage it is re-summing the
j's instead of retaining a running total which the 'for-loop' method does ie.
>>> dd = []
>>> y = d[0]
>>> for i, x in enumerate(d):
>>>y += x
>>>dd.append(y)
As the lists of int
2009/7/3 hyou :
> Hi Sander,
>
> Thanks for the reply. However, the reason that I have to use subprocess.call
> is that if I use
> subprocess.Popen, the pipe sign "|" will break the execution of the command
> (though I don't know
> why). Do you know how can I put "|" correctly in Popen then? (The
On 7/3/2009 1:59 PM Chris Fuller said...
The problem with these list comprehensions is that they have O(n**2)
complexity.
But, the more you work with them the more ease you'll develop at
understanding and deploying them. I often find that a (quick) (perhaps
complex) list comprehension is
[Angus Rodgers]
> ...
> If I started to agitate for changes to a marginal and little-used
> feature of the language within days of starting to learn it, might
> I not quickly earn a reputation as a crank? 8-P
If that's your /goal/, it would be easier to rant about some imagined
flaw in the ring o
On Friday 03 July 2009 15:37, Emile van Sebille wrote:
> On 7/3/2009 1:21 PM Kent Johnson said...
>
> > On Fri, Jul 3, 2009 at 3:49 PM, Dinesh B
> >
> > Vadhia wrote:
> >> d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11, 1, 6, 3, 5, 6, 11, 1]
> >>
> >> and we want:
> >>
> >> [0, 8, 12, 16, 20, 27, 29,
On 7/3/2009 1:21 PM Kent Johnson said...
On Fri, Jul 3, 2009 at 3:49 PM, Dinesh B
Vadhia wrote:
d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11, 1, 6, 3, 5, 6, 11, 1]
and we want:
[0, 8, 12, 16, 20, 27, 29, 34, 35, 36, 41, 52, 63, 64, 70, 73, 78, 84, 95,
96]
dd = [ sum(d[:j]) for j in range(len(d
On Fri, Jul 3, 2009 at 3:49 PM, Dinesh B
Vadhia wrote:
> d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11, 1, 6, 3, 5, 6, 11, 1]
>
> and we want:
>
> [0, 8, 12, 16, 20, 27, 29, 34, 35, 36, 41, 52, 63, 64, 70, 73, 78, 84, 95,
> 96]
> dd = [ sum(d[:j]) for j in range(len(d)) ][1:]
>
> gives:
>
> [0, 8, 1
d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11, 1, 6, 3, 5, 6, 11, 1]
and we want:
[0, 8, 12, 16, 20, 27, 29, 34, 35, 36, 41, 52, 63, 64, 70, 73, 78, 84, 95, 96]
dd = [ sum(d[:j]) for j in range(len(d)) ][1:]
gives:
[0, 8, 12, 16, 20, 27, 29, 34, 35, 36, 41, 52, 63, 64, 70, 73, 78, 84, 95]
Din
>Date: Sat, 04 Jul 2009 00:25:13 +1000
>From: Lie Ryan
>Message-ID:
>
>Angus Rodgers wrote:
>
>> I /think/ I would be naturally inclined to define:
>>
>> floor(x + yj) = floor(x) + floor(y)j for all real x, y
>>
>> z % w = z - floor(z / w) * wfor all complex z, w (!= 0)
>
>I'm not a m
On 7/3/2009 12:09 PM Dinesh B Vadhia said...
I'm suffering from brain failure (or most likely just being brain less!)
and need help to create a list comprehension for this problem:
d is a list of integers: d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11,
1, 6, 3, 5, 6, 11, 1]
Want to create a n
I'm suffering from brain failure (or most likely just being brain less!) and
need help to create a list comprehension for this problem:
d is a list of integers: d = [0, 8, 4, 4, 4, 7, 2, 5, 1, 1, 5, 11, 11, 1, 6, 3,
5, 6, 11, 1]
Want to create a new list that adds the current number and the pri
2009/7/3 hyou :
> Do you know how can I run the command with | sign correctly with popen? Or
> if that’s not possible, can you give me a way to control the output from
> subprocess.call?
subprocess.call does not support this but subprocess.Popen does. See
Doug Hellmann's PMOTW which explains how t
"Yash" wrote
I do not observe the problem on my installation of
Python 3.0.1
I don't see any arrows.
Also the shortcut keywords work fine
Yes the shortcuts worked ok for me too, it was just the
menus that were broken.
I upgraded to v3.1 and everything is fine now. Definitely odd!
Th
Hello,
I encountered this problem that when I'm using Popen to execute a DOS
command "C:\...\devenv" solution.sln /build "Debug|Win32", it doesn't run
anything. However, if I replace "Debug|Win32" with Debug, it works fine.
If I use subprocess.call instead, it runs perfectly - however, I canno
Thanks, I had forgotten the case sensitivity.
David
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Thanks. I had forgotten the case sensitivity.
David
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
>Date: Fri, 03 Jul 2009 12:46:06 +0100
>From: Angus Rodgers
>To: tutor@python.org
>Subject: Re: [Tutor] When are strings interned?
>Message-ID:
>Content-Type: text/plain; charset=us-ascii
>[...]
>Date: Fri, 03 Jul 2009 14:43:21 +0100
>From: Angus Rodgers
>To: tutor@python.org
>Subject: Re: [Tuto
David H. Burns wrote:
> Thanks, Alan,
>
> With the Python3.0, I have installed, he entry "from tkinter import *"
> doesn't produce any error message, but "tk = TK()" results in
> "NameError: 'TK' is not defined". Also for the word "canvas"
Python is CaSe-SEnsITiVe. TK() is different from Tk() and
"David H. Burns" wrote in message
news:4a4d65e5.3040...@cherokeetel.net...
Thanks, Alan,
With the Python3.0, I have installed, he entry "from tkinter import *"
doesn't produce any error message, but "tk = TK()" results in "NameError:
'TK' is not defined". Also for the word "canvas"
As yo
Angus Rodgers wrote:
> Presumably a different optimisation is going on here:
>
"green ideas" is "green ideas"
> True
You're correct, there is another layer of optimization, now related to
constant string caching. The caching sometimes happens, sometimes not,
depending on a very intricate imp
Angus Rodgers wrote:
> I'm a little confused by: (i) the definition of the modulus and
> floor division functions for complex arguments; (ii) the fact
> that these functions for complex arguments are now "deprecated";
> and (iii) the fact that the math.floor() function is not defined
> at all for
[Angus Rodgers]
> I'm a little confused by: (i) the definition of the modulus and
> floor division functions for complex arguments;
Perhaps you're confused by the current definitions simply because they
don't make good sense.
> (ii) the fact that these functions for complex arguments are
> now "
This is partly a test to see if I can reply in the correct format
to a message in the tutor list (which I receive in digest format).
>Date: Thu, 02 Jul 2009 20:39:28 +1000
>From: Lie Ryan
>
>Angus Rodgers wrote:
>[...]
> p = "green ideas"
> q = "green ideas"
> p == q
>> True
> p i
This is partly a test to see if I can reply in the correct format
to a message in the tutor list (which I receive in digest format).
>Date: Thu, 02 Jul 2009 20:39:28 +1000
>From: Lie Ryan
>
>Angus Rodgers wrote:
>[...]
> p = "green ideas"
> q = "green ideas"
> p == q
>> True
> p i
karma wrote:
Hi all ,
I have a nested list in the structure
[root,[leftSubtree],[RightSubtree]] that I want to print out. I was
thinking that a recursive solution would work here, but so far I can't
quite get it working. This is what I have so far:
Can someone suggest whether this is suited to
Alan,
I do not observe the problem on my installation of
Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)]
on Win Vista or on Win XP SP 3
I don't see any arrows.
Also the shortcut keywords work fine and I am able to use the mouse freely.
The only problem I get is that
Thanks, Alan,
With the Python3.0, I have installed, he entry "from tkinter import *"
doesn't produce any error message, but "tk = TK()" results in
"NameError: 'TK' is not defined". Also for the word "canvas"
As you suggest, I probably need to start with a 2.x version.
___
I'm a little confused by: (i) the definition of the modulus and
floor division functions for complex arguments; (ii) the fact
that these functions for complex arguments are now "deprecated";
and (iii) the fact that the math.floor() function is not defined
at all for a complex argument.
If I were
Thanks all for the feedback. As you all rightly pointed out, I was
confusing myself by not keeping a track of the recursion depth.
Thanks again
2009/7/3 Alan Gauld :
>
> "karma" wrote
>
>> thinking that a recursive solution would work here, but so far I can't
>> quite get it working. This is wha
"karma" wrote
thinking that a recursive solution would work here, but so far I can't
quite get it working. This is what I have so far:
Can someone suggest whether this is suited to a recursive solution and
Yes certainly
if so, what am I doing wrong.
L = ['a',
['b',
John [H2O] wrote:
>
>
> spir wrote:
>>
>> What you're looking for is a dictionary...
>> s = {"cheese":"Brie", "country":"France", ...}
>>
>> Or maybe a kind of object type that works ~ like a dict, but with object
>> syntax (get rid of {} and "" for keys). Example:
>>
>> class Stuff(object):
>>
karma wrote:
> Hi all ,
>
> I have a nested list in the structure
> [root,[leftSubtree],[RightSubtree]] that I want to print out. I was
> thinking that a recursive solution would work here, but so far I can't
> quite get it working. This is what I have so far:
>
> Can someone suggest whether this
spir wrote:
>
>
> What you're looking for is a dictionary...
> s = {"cheese":"Brie", "country":"France", ...}
>
> Or maybe a kind of object type that works ~ like a dict, but with object
> syntax (get rid of {} and "" for keys). Example:
>
> class Stuff(object):
> def __iter__(self):
>
Hi all ,
I have a nested list in the structure
[root,[leftSubtree],[RightSubtree]] that I want to print out. I was
thinking that a recursive solution would work here, but so far I can't
quite get it working. This is what I have so far:
Can someone suggest whether this is suited to a recursive sol
40 matches
Mail list logo