In article 40a6bfac-3f4b-43f4-990b-224cb2b65...@i19g2000pro.googlegroups.com,
Carl Banks pavlovevide...@gmail.com wrote:
FWIW, I think it perfectly reasonable to let an application print a
traceback on an error. I've gotten a few bug reports on a little tool
I maintain where the user copies the
On Aug 20, 6:41 pm, Gregory Ewing greg.ew...@canterbury.ac.nz wrote:
bvdp wrote:
The whole problem I was having is that I was trying to tie a small
application (an helper to the main application) to use a bit of the
existing code as a pseudo-library.
This is precisely the reason that it's
bvdp wrote:
The whole problem I was having is that I was trying to tie a small
application (an helper to the main application) to use a bit of the
existing code as a pseudo-library.
This is precisely the reason that it's a bad idea to
directly terminate the program from somewhere deep inside
Steven D'Aprano a écrit :
Oh my ... I've seen people writing Java in Python, C++ in Python, Perl in
Python, even VB in Python, but this is the first time I've meet some one
who wants to write assembler in Python :)
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 15 Aug 2010 21:01:04 -0700, Carey Tilden wrote:
On Sun, Aug 15, 2010 at 6:43 PM, bvdp b...@mellowood.ca wrote:
Not to belabor the point .. but func is not a standard lib module.
It's part of a much larger application ... and in that application it
makes perfect sense to terminate
On Sun, 15 Aug 2010 18:43:49 -0700, bvdp wrote:
[...]
However, I have gotten hit with more than one comment like yours. So,
could you please clarify? Is it bad form to exit an application with
sys.exit(1) when an error in a file the application is processing is
found?
My two cents worth...
On Mon, Aug 16, 2010 at 4:18 AM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
On Sun, 15 Aug 2010 21:01:04 -0700, Carey Tilden wrote:
On Sun, Aug 15, 2010 at 6:43 PM, bvdp b...@mellowood.ca wrote:
Not to belabor the point .. but func is not a standard lib module.
It's part of
Steven D'Aprano wrote:
On Sat, 14 Aug 2010 16:05:05 -0700, bvdp wrote:
snip
def error(s):
print Error, s
sys.exit(1)
snip
This general technique is called monkey patching.
snip
You can either manually exit from your own error handler:
def myerror(s):
print new error
On 8/14/2010 4:05 PM, bvdp wrote:
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
... do some processing
... call error() if bad .. go to system exit.
... more processing
Fix func. That's terrible
On Aug 15, 12:52 pm, John Nagle na...@animats.com wrote:
On 8/14/2010 4:05 PM, bvdp wrote:
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
... do some processing
... call error() if bad .. go to
On Sun, Aug 15, 2010 at 6:43 PM, bvdp b...@mellowood.ca wrote:
Not to belabor the point .. but func is not a standard lib module.
It's part of a much larger application ... and in that application it
makes perfect sense to terminate the application if it encounters an
error. I fail to see the
On Aug 15, 6:43 pm, bvdp b...@mellowood.ca wrote:
On Aug 15, 12:52 pm, John Nagle na...@animats.com wrote:
On 8/14/2010 4:05 PM, bvdp wrote:
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
... do some processing
... call error() if bad .. go to system exit.
... more processing
and then I write a new program, test.py, which:
import foo
def
On Sunday 15 August 2010, it occurred to bvdp to exclaim:
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
... do some processing
... call error() if bad .. go to system exit.
... more processing
On Sat, 14 Aug 2010 16:05:05 -0700, bvdp wrote:
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
... do some processing
... call error() if bad .. go to system exit. ... more processing
and then I
On Aug 14, 4:05 pm, bvdp b...@mellowood.ca wrote:
Assuming I have a module 'foo.py' with something like this:
def error(s):
print Error, s
sys.exit(1)
def func(s):
... do some processing
... call error() if bad .. go to system exit.
... more processing
and then I
On Sat, Aug 14, 2010 at 5:23 PM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
snip
Oh my ... I've seen people writing Java in Python, C++ in Python, Perl in
Python, even VB in Python, but this is the first time I've meet some one
who wants to write assembler in Python :)
+1 QOTW
An exception will walk up the stack, calling any cleaning-up code that needs
to be done (removing object references, executing finally: blocks, exiting
context managers properly. It won't break anything. Don't be afraid of
Python's high-level features!
Okay, I believe you (and the rest of
On Aug 14, 5:23 pm, Steven D'Aprano st...@remove-this-
cybersource.com.au wrote:
This general technique is called monkey patching.
New term for me :)
Now, if an error is encountered myerror() is called. Fine. But execution
resumes in func(). Not exactly what I wanted.
Of course it does.
19 matches
Mail list logo