Error with print(f"") format and staticmethod

SyntaxEditor Python Language Add-on for WPF Forum

Posted 2 years ago by Jane
Version: 18.1.0
Avatar

I was trying the the Python Editor (Python Lang. Add-on) using your sample demos and tried adding the line below. Is there any reason why it shows as syntax error for print(f"")?

    def sayName(self):
        print( f"My name is {self.name}")

Also, for intellisense,

1. it only shows the staticmethods whereas in VSCODE for example, it shows all the methods.

2. it doesn't show the object methods when accessing an instance from an array. Is this is expected?

[Modified 2 years ago]

Comments (1)

Posted 2 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hello,

It looks like you are using an old version of the add-on that maybe didn't yet support f-string syntax?  If you remove the "f" and it removes the syntax error, that's what's going on.  Newer add-on versions support f-strings.

For the other questions, please give example code we can paste into our Python Editor demo to see what you see.  You might also want to test in v22.1 first to see if either issues are already resolved in the newer version.  Also keep in mind that the add-on doesn't have a Python interpreter built in.  While it can parse code and do syntax kind of checking, it doesn't have the ability to see what runtime output would be, meaning code that creates objects dynamically and other complex scenarios might not be able to be resolved.


Actipro Software Support

The latest build of this product (v24.1.1) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.