On 2011.05.11 01:05 PM, Roy Smith wrote:
You want to raise specific errors. Let's say you've got a function like
this:
def airspeed(swallow):
speeds = {european: 42,
african, 196}
return speeds[swallow]
If somebody passes an invalid string, it will raise KeyError as
On 12/05/2011 20:14, Andrew Berg wrote:
On 2011.05.11 01:05 PM, Roy Smith wrote:
You want to raise specific errors. Let's say you've got a function like
this:
def airspeed(swallow):
speeds = {european: 42,
african, 196}
return speeds[swallow]
If somebody passes an
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like NameError: name 'HelloError' is not defined. I don't know how to
define the exception.
--
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 05/12/2011 04:12 PM, Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like NameError: name 'HelloError' is not
On Thu, May 12, 2011 at 03:12:39PM -0500, Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like NameError: name 'HelloError' is not defined. I don't know how to
On 12/05/2011 21:12, Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like NameError: name 'HelloError' is not defined. I don't know how to
define the exception.
Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get something
like NameError: name 'HelloError' is not defined. I don't know how to
define the exception.
class
On 2011.05.12 03:20 PM, Corey Richardson wrote:
class HelloError(Exception):
pass
Of course, there are all sorts of other things you could do with your
exception.
http://docs.python.org/tutorial/errors.html#user-defined-exceptions
So that's where that info is. I wasn't looking in the
On Thu, 12 May 2011 15:26:27 -0500, Tycho Andersen wrote:
On Thu, May 12, 2011 at 03:12:39PM -0500, Andrew Berg wrote:
On 2011.05.12 02:25 PM, MRAB wrote:
You can raise an exception wherever you like! :-)
If I raise an exception that isn't a built-in exception, I get
something like
Andrew Berg bahamutzero8...@gmail.com writes:
So that's where that info is. I wasn't looking in the tutorial
section.
Does this mean you haven't worked through the tutorial? Time to remedy
that.
--
\ “You are welcome to visit the cemetery where famous Russian and |
`\Soviet
I'm a bit new to programming outside of shell scripts (and I'm no expert
there), so I was wondering what is considered the best way to handle
errors when writing a module. Do I just let exceptions go and raise
custom exceptions for errors that don't trigger a standard one? Have the
function/method
- Original Message -
From: Andrew Berg bahamutzero8...@gmail.com
To: python-list@python.org
Sent: Wednesday, May 11, 2011 10:29 AM
Subject: Proper way to handle errors in a module
I'm a bit new to programming outside of shell scripts (and I'm no expert
there), so I was wondering
On 11/05/2011 18:29, Andrew Berg wrote:
I'm a bit new to programming outside of shell scripts (and I'm no expert
there), so I was wondering what is considered the best way to handle
errors when writing a module. Do I just let exceptions go and raise
custom exceptions for errors that don't
In article mailman.1415.1305134998.9059.python-l...@python.org,
Andrew Berg bahamutzero8...@gmail.com wrote:
I'm a bit new to programming outside of shell scripts (and I'm no expert
there), so I was wondering what is considered the best way to handle
errors when writing a module. Do I just
On 2011.05.11 12:57 PM, Patty wrote:
Hi Andrew -
Sometimes you want an exception come up and then use that information to
take your
program in some direction.
Right, but I'm wondering how I should handle errors in a module, where
different people will want their programs to do different
way to handle errors in a module
On 2011.05.11 12:57 PM, Patty wrote:
Hi Andrew -
Sometimes you want an exception come up and then use that information to
take your
program in some direction.
Right, but I'm wondering how I should handle errors in a module, where
different people will want
16 matches
Mail list logo