4 ms·
I've recently written a Blender addon using Python that came to just over 1000 LOC. Not big at all and yet already I was running into problems that are just non
by hacker_9 10y ago
I've recently written a Blender addon using Python that came to just over 1000 LOC. Not big at all and yet already I was running into problems that are just non existent in static languages. I couldn't refactor variable names and had to manually replace the text which was very error prone, I had no help from the language about whether I had referenced a variable by the right name as it would just create a new one, no 'goto defintion' and instead I was reduced to scrolling or ctrl+F, no braces to tell me where scope starts and ends (which you wouldn't think mattered, but only relying on indentation actually gets quite messy), and no contextual knowledge of the blender APIs unless I knew what to Google and it often came down to someone asking the same question on stackexchange.
The only way I could manage it was to write tiny functions, so I could literally eyeball the scope and keep all the details in my short term memory. I would not recommend using this language for larger projects.
- olau 10y agoYou have obviously previously been relying on a context-sensitive IDE. Those things exist for Python too, or you can turn a text editor like Emacs into one by installing various packages. It's true that there are limits to what they can do, since Python will let you do some pretty funky stuff, but you were nowhere near those limits. Regarding the missing API documentation: Python programmers will often have a Python shell open and just experiment with stuff in there with instant feedback. For instance, I know one project where someone decided to write a relatively large Python plugin for Excel. One essential component was a button that put up a shell so you could experiment with the Excel COM API live. So you could access the sheets and write stuff into cells and see Excel update them. If you write Python like you write .NET or Java code, you'll probably only see the downsides. Getting a taste of the upside requires adjusting your coding style. It's going to take some time. And yes, there are of course downsides, language design is a trade-off.
- ves 10y agoif you spend 15 or so minutes configuring your editor (I use vim, so python-mode and ctags for me), you can get around all of these issues you mentioned.
- arjie 10y agoIs `python-mode` and `ctags` all that you have for Python specifically or is there more?
- kirang1989 10y agoYou should try elpy-mode or anaconda-mode. You get better completion, integration with eldoc for documentation, go-to definition and much more.
- brianwawok 10y agoRenames are one reason why code I write in Python have way more unit tests then code I write in Scala. I think the end result of well unit tested Python is better than lazy tested Scala...