I come from C++ where I really abused the use of references in function parameters. Example:

void MyFunction( int &MyNum, str &MyString, array &MyList, object &MyObject ).

What is the most common way to send and receive multiple elements in Python for Blender? From what I've read, Tuples sound like the answer? Is it common to use 3-5 elements in a Tuple? Do you guys generally build a structure/class for every group of related data that you send/receive for functions?

Another, almost related, question: If I have a function that needs to accept a list, then possibly add or remove objects from that list to update it, would I need to return that list from the function after? Is the list being sent as a reference or copy? I have trouble with this aspect of python in general. What types of variables get copied as references, if any? And if none, would it not be massive overhead to send and return lists to/from functions?

I know I'm being lazy and impatient by not learning python before diving into this head first, so apologies to those that took the time to do so. I'm just wanting to bang out this add-on so I can get back to modeling :)

Thanks for any help!

  • 4
    $\begingroup$ In the end it is python. Use python docs and / or search stackoverflow re how python handles lists etc. $\endgroup$ – batFINGER Sep 8 '19 at 5:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.