[Bf-python] Consistency issue

Michel Selten michel.s at home.nl
Thu Oct 2 21:32:31 CEST 2003


On Thu, 2003-10-02 at 03:14, Willian Padovani Germano wrote:
> Hi,
> 
> Months ago, Jacques suggested that the better method would be to have tuples
> everywhere.  That's not a bad idea, but we had to keep compatibility with
> 2.25.
> 
> Now's a good time to start fixing this where it happens, allowing both cases
> (ex: someFunc([f,f,f])  or someFunc(f,f,f) calls).

Yes, I agree on this part. It'll take some small effort to go through
all functions and find inconsistencies. In the end, the user is the one
who doesn't have to think of "what method of parameters does this
function take?"

> I like this one, too.  And you're right, once we "unwrap" a pytuple, it
> isn't available for another parsing.  A simple way to solve this:  first
> check the size of the PyObject *args parameter.  If the function expects
> [f,f,f] or f, f, f, it's simple to decide: the size of 'args' will be either
> 1 or 3.
> 
> Check this method in rgbTuple.c, for example:

Ah, that's exactly what I wanted. This is perfect. Thanks for pointing
out the location where it's already used!

> > the deprecation of the old method in a few releases and support the new
> > method only after that.
> 
> Well, no need to, we can document the better one and let the old still
> there, undocumented.

True, or maybe we could introduce a sort of a script maintainer mode.
When the user enables that mode, blender will throw all kinds of
warnings to the user about the use of 'old' functions and of course the
proposed alternative.
When the user does not enable maintainer mode, no warnings will be
generated.
The maintainer mode could be enabled through a user setting in the
settings window.

> BTW: Ton mentioned he's on a coding spree (ok, not his words).  Our little
> corner wouldn't interfere with anything, but even so, I'll wait one or two
> days before committing anything.

Well, I'm confident he's not touching the Python code at all. That's one
part he knows very little about. Let's keep it that way ;) (Our nice
little playground).

With regards,
	Michel





More information about the Bf-python mailing list