[Bf-python] API refactoring considerations

Gilbert, Joseph T. jgilbert at tigr.ORG
Wed May 31 16:36:20 CEST 2006


Or if an assignment to a valid attribute fails. 
You're other options are a TypeError - operation on an object of bad
type.
or a ValueError - operation on Object of correct type but wrong value.

In the case of args checks maybe TypeError and ValueError would be more
appropriate.

-----Original Message-----
From: bf-python-bounces at projects.blender.org
[mailto:bf-python-bounces at projects.blender.org] On Behalf Of Ken Hughes
Sent: Wednesday, May 31, 2006 10:29 AM
To: Blender Foundation Python list
Subject: Re: [Bf-python] API refactoring considerations

Gilbert, Joseph T. wrote:
> 2) We have always clamped input to whatever the internal range is and
> have not thrown an error. In theory though, it may be better to throw
an
> error because the user may have expected a certain result and didn't
> realize that his value got clamped. All the other methods throw
> AttributeError when they receive unexpected parameters.  I think in
this
> case though we need to throw a ValueError because we have the correct
> type of argument but it's the wrong value for the method.

I don't think we should normally be throwing AttributeErrors; IIRC it is

supposed to happen if the attribute doesn't exist.

Ken
_______________________________________________
Bf-python mailing list
Bf-python at projects.blender.org
http://projects.blender.org/mailman/listinfo/bf-python



More information about the Bf-python mailing list