Using Python 2.5 grammar and VM. Using Eclipse Helios and PyDev both fully patched on Windows XP.
My code:
foo=lambdax: x@fooclassbar(object):pass
The "Problems" box shows the error message:
"Encountered "class" at line 13, column 1. Was expecting one of: "def" ... "@" ...
The PyDev editor also highlights the word "class" in the declaration of "bar" in red accordingly (not expected). If I use the def statement instead of the class statement to create "bar", the compiler does not complain and the text editor does not highlight anything in red (as expected).
Using decorators on classes, while perhaps unusual, is valid and realistic. I have implemented a Singleton decorator which creates a singleton subclass of the given class dynamically and returns it, so that repeated calls to the factory return the same object, and issubclass() and isinstance() work as expected.
I do enjoy PyDev and it is a great help to productivity. I apologize that I do not have time to work on a patch myself or experiment with non-release SVN revisions. If there are questions about my settings I will be happy to answer. Hopefully this report helps to improve the tool for others' benefit. Thank you.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, that's correct when using a Python 2.5 grammar (class decorators were only added on Python 2.6 - so, if you set your grammar to Python 2.6, it should work).
Cheers,
Fabio
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using Python 2.5 grammar and VM. Using Eclipse Helios and PyDev both fully patched on Windows XP.
My code:
The "Problems" box shows the error message:
The PyDev editor also highlights the word "class" in the declaration of "bar" in red accordingly (not expected). If I use the def statement instead of the class statement to create "bar", the compiler does not complain and the text editor does not highlight anything in red (as expected).
Using decorators on classes, while perhaps unusual, is valid and realistic. I have implemented a Singleton decorator which creates a singleton subclass of the given class dynamically and returns it, so that repeated calls to the factory return the same object, and issubclass() and isinstance() work as expected.
I do enjoy PyDev and it is a great help to productivity. I apologize that I do not have time to work on a patch myself or experiment with non-release SVN revisions. If there are questions about my settings I will be happy to answer. Hopefully this report helps to improve the tool for others' benefit. Thank you.
Actually, that's correct when using a Python 2.5 grammar (class decorators were only added on Python 2.6 - so, if you set your grammar to Python 2.6, it should work).
Cheers,
Fabio
Sorry for wasting your time. I had been using 2.6 to test all that time, and not realized it.