On 17/08/2017 at 04:17, xxxxxxxx wrote:
I was just watching a quick tutorial on different ways of calculating spline length, and I came across some syntax I can't figure out:
what does this mean?
On 17/08/2017 at 05:03, xxxxxxxx wrote:
On 17/08/2017 at 05:52, xxxxxxxx wrote:
that doesn't mention, let alone explain what op is.
Also there is no instance in that documentation of SplineLengthData being called as SlineLengthData(anything)
On 17/08/2017 at 09:56, xxxxxxxx wrote:
Ah, completely oversaw that. Apologies.
Good question, although I believe, that this does nothing at all.
I'd say, that the constructor wrapper just filters out any arguments, that are too much.
On 17/08/2017 at 11:00, xxxxxxxx wrote:
No prob, it just confuses me! whats it for?! I'll have to try without and see what happens.
I was hoping I could figure out how to use it by just looking at that original documentation page, but I had no idea that it first needed to have an instance created with that specific syntax, or is that what ".__init__()" is supposed to represent? ..
On 17/08/2017 at 11:09, xxxxxxxx wrote:
I suggest you to read http://www.python-course.eu/python3_magic_methods.php
On 18/08/2017 at 02:31, xxxxxxxx wrote:
What op does depends on what op is. It's syntactic sugar for
calling op.__getitem__(0). When you see __getitem__() in the
docs of a class, that's when you can use  on objects of that
class. E.g. you can use it to retrieve values from a BaseContainer.
On 18/08/2017 at 06:39, xxxxxxxx wrote:
Not much left to add for me...
In Script Manager op is a predefined variable pointing to the currently selected object. So if op hasn't been reassigned in the tutorial, that's what it is.
And yes, when creating a SplineLengthData the parameter will be ignored. It's redundant in that line of the tutorial and I'd recommend to omit passing a parameter there.
On 23/08/2017 at 14:25, xxxxxxxx wrote:
Thanks everyone! Much appreciated.