Results 1 to 3 of 3
  1. #1

    Please help me make sence of this line

    I'm eager to learn Python at the moment and still in the process to make sense of python syntax.
    I came across a peace of code that measures the length of a curve. Inside a for loop, i found a line like:

    for i in edges:
    variable1, variable2 = i.vertices

    I cant make sense of it. Please help.
    Last edited by SidV; 10-Apr-18 at 06:27.

  2. #2
    Member Secrop's Avatar
    Join Date
    Dec 2011
    somevar=[('value1'), ('value2')]
    var1, var2 = somevar



    In that case, as an edge has two vertices, and i.vertices is an array with two variables. One will be attributed to variable1, and the other to the variable2
    Last edited by Secrop; 10-Apr-18 at 07:19.

  3. #3
    Ah ok, this means the first variable gets the first vertice in list, the second variable gets the second and looping through a second time the vertex 3 is stored in variable 1 and vert4 in variable 2 and so on...

    Thx mate, good explanation!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts