On Mon, 05 Apr 2010 10:08:51 -0700, John Nagle wrote:
> Alf P. Steinbach wrote:
>
>> Best is however to recognize that you have some state (your variable)
>> and some operations on that state (your callback), and that that is
>> what objects are all about. I.e. wrap your logic in a class. Then
>>
On 2010-04-05 10:08:51 -0700, John Nagle said:
Yes. Functions with persistent state are generally a bad idea.
Unfortunately, the "signal" module requires a callback parameter
which is a plain function. So you have to send it a function,
closure, or lambda. Here, it's being sent a clos
On 2010-04-05 12:08 PM, John Nagle wrote:
Alf P. Steinbach wrote:
Best is however to recognize that you have some state (your variable)
and some operations on that state (your callback), and that that is
what objects are all about. I.e. wrap your logic in a class. Then
'lastModifiedTime' become
Alf P. Steinbach wrote:
Best is however to recognize that you have some state (your variable)
and some operations on that state (your callback), and that that is what
objects are all about. I.e. wrap your logic in a class. Then
'lastModifiedTime' becomes an instance attribute, and 'handler' be
* Stephen Hansen:
On 2010-04-04 15:22:48 -0700, Alf P. Steinbach said:
* johngilbrough:
I cannot make sense of what's happening here ... I'm getting the
following error:
(1)
At least in Py3 you can declare the variable as 'global', like this:
global lastModifiedTime
within the function
On 2010-04-04 15:22:48 -0700, Alf P. Steinbach said:
* johngilbrough:
I cannot make sense of what's happening here ... I'm getting the
following error:
(1)
At least in Py3 you can declare the variable as 'global', like this:
global lastModifiedTime
within the function.
Actually, what
* johngilbrough:
I cannot make sense of what's happening here ... I'm getting the
following error:
initializing last modified time
/home/john/Dropbox/Projects/python/scripts/src 29
referencing last modified time
/home/john/Dropbox/Projects/python/scripts/src 29
referencing last modified time
Tr
Wells Oliver wrote:
Writing a class which essentially spiders a site and saves the files
locally. On a URLError exception, it sleeps for a second and tries again (on
404 it just moves on). The relevant bit of code, including the offending
method:
class Handler(threading.Thread):
def __in
On Fri, 19 Jun 2009 11:16:38 -0500
Wells Oliver wrote:
> def save(self, uri, location):
> try:
> handler = urllib2.urlopen(uri)
> except urllib2.HTTPError, e:
> if e.code == 404:
>
Wells Oliver schrieb:
Writing a class which essentially spiders a site and saves the files
locally. On a URLError exception, it sleeps for a second and tries again
(on 404 it just moves on). The relevant bit of code, including the
offending method:
class Handler(threading.Thread):
def
On Jun 19, 10:16 am, Wells Oliver wrote:
> Writing a class which essentially spiders a site and saves the files
> locally. On a URLError exception, it sleeps for a second and tries again (on
> 404 it just moves on). The relevant bit of code, including the offending
> method:
>
> [snip]
>
> But wha
Writing a class which essentially spiders a site and saves the files
locally. On a URLError exception, it sleeps for a second and tries again (on
404 it just moves on). The relevant bit of code, including the offending
method:
class Handler(threading.Thread):
def __init__(self, url):
Pete Bartonly wrote:
>
> Quick question, probably quite a simple matter. Take the follow start of
> a method:
>
>
> def review(filesNeedingReview):
>
> for item in filesNeedingReview:
> (tightestOwner, logMsg) = item
>
> if (logMsg != None):
> for logInfo in lo
Peter Otten wrote:
> Pete Bartonly wrote:
>
>> Quick question, probably quite a simple matter. Take the follow start of
>> a method:
>>
>>
>> def review(filesNeedingReview):
>>
>> for item in filesNeedingReview:
>> (tightestOwner, logMsg) = item
>>
>> if (logMsg != None):
>
A.T.Hofkamp wrote:
> On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote:
>> Quick question, probably quite a simple matter. Take the follow start of
>> a method:
> With respect to compactness and style, you can move your multi-assignment
> statement in the for loop, as in
[snip]
Btw, thanks
A.T.Hofkamp wrote:
> On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote:
>> Quick question, probably quite a simple matter. Take the follow start of
>> a method:
>>
>>
>> def review(filesNeedingReview):
>>
>> for item in filesNeedingReview:
>> (tightestOwner, logMsg) = item
>>
>>
On 2007-10-25, Tim Williams <[EMAIL PROTECTED]> wrote:
> On 25/10/2007, A.T.Hofkamp <[EMAIL PROTECTED]> wrote:
>> On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote:
>> >
>> Also, brackets around conditions (in the if) are not needed, and comparing
>> against None is usually done with 'is' or '
On 25/10/2007, A.T.Hofkamp <[EMAIL PROTECTED]> wrote:
> On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote:
> >
> Also, brackets around conditions (in the if) are not needed, and comparing
> against None is usually done with 'is' or 'is not' instead of '==' or '!='.
> The result is then
>
> if
On Oct 25, 10:02 am, Pete Bartonly <[EMAIL PROTECTED]> wrote:
> Quick question, probably quite a simple matter. Take the follow start of
> a method:
>
> def review(filesNeedingReview):
>
> for item in filesNeedingReview:
> (tightestOwner, logMsg) = item
>
> if (logMsg != None
Pete Bartonly wrote:
> Quick question, probably quite a simple matter. Take the follow start of
> a method:
>
>
> def review(filesNeedingReview):
>
> for item in filesNeedingReview:
> (tightestOwner, logMsg) = item
>
> if (logMsg != None):
> for logInfo in
On 2007-10-25, Pete Bartonly <[EMAIL PROTECTED]> wrote:
>
> Quick question, probably quite a simple matter. Take the follow start of
> a method:
>
>
> def review(filesNeedingReview):
>
> for item in filesNeedingReview:
> (tightestOwner, logMsg) = item
>
> if (logMsg != None)
21 matches
Mail list logo