; end line Python

Hi all,

import Rhino as rh;

def Def1():
    go = rh.Input.Custom.GetObject();
    go.SetCommandPrompt("Select points");
    go.GeometryFilter = rh.DocObjects.ObjectType.Point;
    go.GetMultiple(1, 0);
Def1();

I had ported a piece of C# code into adapted Python,
but I forgot to remove the >;< at the end of the lines
Is it normal for code to run in Python?

; allows one to put multiple statements on one line in Python, it’s not really recommended, but if the code runs with nothing after the ;, I guess it won’t do any harm…

Unless you are actually using this feature somewhere, you could also just do a general replace and replace with an empty string.

1 Like

ok thanks much, I didn’t know about this peculiarity now that you told me,
I tried running two statements on the same line and it works, great to know :+1:

I would use it only very sparingly, because it is not a much used feature. It can easily lead to unintended bugs.

1 Like

thanks :+1: