On Jul 31, 2012, at 12:26 PM, tutor-requ...@python.org wrote:
> Message: 2
> Date: Tue, 31 Jul 2012 10:44:29 -0400
> From: Tino Dai
> To: "Steven D'Aprano"
> Cc: "tutor@python.org"
> Subject: Re: [Tutor] finally without try or except
> Message-ID
On Tue, Jul 31, 2012 at 5:23 PM, Prasad, Ramit wrote:
> [snip]
>
> > >> This will be the most robust as it will
> > >> also work for cases where the program is terminated without the use of
> > >> the keyboard (i.e. kill -9, task manager, computer reboot, etc.) but
> >
> > That unfortunately is n
[snip]
> >> This will be the most robust as it will
> >> also work for cases where the program is terminated without the use of
> >> the keyboard (i.e. kill -9, task manager, computer reboot, etc.) but
>
> That unfortunately is not so. kill -9 does *not* send a signal or raise an
> exception. It
On Mon, Jul 30, 2012 at 9:01 PM, Steven D'Aprano wrote:
> If you want to be robust, it is best not to try to beat the database. That
> means you should write to the database as soon as you can, as often as you
> need to, and let the database do what it does best: reliable transaction
> storage. An
Tino Dai wrote:
I just remember that there was a performance hit or something for doing
that.
Does that sound familiar to anyone?
Yes, and no.
Creating a try block in Python is lightweight and fast. It is about as fast as
the "pass" statement, that is, pretty damn fast and more or less faste
Tino Dai wrote:
Yes, but that would involve surrounding the entire method with a try except
finally block. I was
told by the Python-Guru-In Residence that shouldn't emulate Java code in
Python, and that was
generally bad programming practice (no flame war intended)
And that is correct. It is *
On Mon, Jul 30, 2012 at 3:10 PM, Tino Dai wrote:
> On Mon, Jul 30, 2012 at 1:52 PM, Mark Lawrence
> wrote:
>
>> Sorry I'm not completely sure what you're asking for but will this help
>> http://docs.python.org/library/atexit.html ?
>>
> I think this might be what I'm looking for. But for about 2
On Mon, Jul 30, 2012 at 3:35 PM, Brett Ritter wrote:
> On Mon, Jul 30, 2012 at 12:20 PM, Tino Dai wrote:
> > Yes, but that would involve surrounding the entire method with a try
> except
> > finally block. I was
> > told by the Python-Guru-In Residence that shouldn't emulate Java code in
> > Pyt
On Mon, Jul 30, 2012 at 12:20 PM, Tino Dai wrote:
> Yes, but that would involve surrounding the entire method with a try except
> finally block. I was
> told by the Python-Guru-In Residence that shouldn't emulate Java code in
> Python, and that was
> generally bad programming practice (no flame wa
On 30-Jul-12 10:52, Mark Lawrence wrote:
On 30/07/2012 17:56, Tino Dai wrote:
Is there anyway to execute a block of code at the end of a
program in
2.6 regardless of what happened before eg exiting normally or died
because
of an exception?
Sorry I'm not completely sure what you're askin
On 30/07/12 17:56, Tino Dai wrote:
Is there anyway to execute a block of code at the end of a program
in 2.6 regardless of what happened before eg exiting normally or died
because of an exception?
Yes, try/finally.
That's what it's there for.
I was thinking about maybe a free standing
On Mon, Jul 30, 2012 at 1:44 PM, Prasad, Ramit wrote:
> > Actually, what I'm doing is keeping a pending item log in memory as an
> array
> > and then saving it to the DB at the end of the program, but what happens
> if
> > the user hits ctrl-c, then the pending items array is lost. That's the
> us
On Mon, Jul 30, 2012 at 2:44 PM, Albert-Jan Roskam wrote:
> *From:* Tino Dai
>
> *To:* nz*tutor pythonzzz
> *Sent:* Monday, July 30, 2012 6:56 PM
> *Subject:* [Tutor] finally without try or except
>
> Hi!
>
> Is there anyway to execute a block of code at th
On Mon, Jul 30, 2012 at 1:52 PM, Mark Lawrence wrote:
> On 30/07/2012 17:56, Tino Dai wrote:
>
>> Hi!
>>
>> Is there anyway to execute a block of code at the end of a program
>> in
>> 2.6 regardless of what happened before eg exiting normally or died because
>> of an exception?
>> I was thin
From: Tino Dai
To: nz*tutor pythonzzz
>Sent: Monday, July 30, 2012 6:56 PM
>Subject: [Tutor] finally without try or except
>
>
>Hi!
>
>
> Is there anyway to execute a block of code at the end of a program in 2.6
>regardless of what happened before eg exiting
On 30/07/2012 17:56, Tino Dai wrote:
Hi!
Is there anyway to execute a block of code at the end of a program in
2.6 regardless of what happened before eg exiting normally or died because
of an exception?
I was thinking about maybe a free standing finally code block or a
decorator.
Any hint
> Actually, what I'm doing is keeping a pending item log in memory as an array
> and then saving it to the DB at the end of the program, but what happens if
> the user hits ctrl-c, then the pending items array is lost. That's the use
> case that I'm looking for a solution to.
http://docs.python.or
On Mon, Jul 30, 2012 at 1:16 PM, Marc Tompkins wrote:
> On Mon, Jul 30, 2012 at 9:56 AM, Tino Dai wrote:
>
>> Hi!
>>
>> Is there anyway to execute a block of code at the end of a program
>> in 2.6 regardless of what happened before eg exiting normally or died
>> because of an exception?
>> I
On Mon, Jul 30, 2012 at 9:56 AM, Tino Dai wrote:
> Hi!
>
> Is there anyway to execute a block of code at the end of a program in
> 2.6 regardless of what happened before eg exiting normally or died because
> of an exception?
> I was thinking about maybe a free standing finally code block or
Hi!
Is there anyway to execute a block of code at the end of a program in
2.6 regardless of what happened before eg exiting normally or died because
of an exception?
I was thinking about maybe a free standing finally code block or a
decorator.
Any hints?
Tino
20 matches
Mail list logo