PDA

View Full Version : Is it worth learning Python yet?



Blochi
10-27-2012, 03:58 PM
Hey guys,

Sure, sooner or later Python will be the only way to script in LW.
The thing is, I am fully pleased with LScript, proficient and fast. When I look at the Python stuff it seems very alien to me. LScript is much like JavaScript, but Python and the way it hooks in seems more like a C++ derivative.

So here are my questions:

1. Does Python right now give me access to things in Lightwave that I don't have in LScript? (not talking about external libraries)
2. Is there a runtime speed advantage in Python code versus LScript code?
3. How reusable is the code from LW's Python really? If I wanted to run it in Maya, is that a trivial conversion or just as much effort as starting over?

Can anybody give me another good reason to switch to Python (except for "Lscript is dead", which it isn't for me at all)

Blochi

BigHache
10-27-2012, 11:05 PM
I'll attempt this...



1. Does Python right now give me access to things in Lightwave that I don't have in LScript? (not talking about external libraries)

Yes, that is part of the idea. What exactly? At the moment, perhaps nothing, at least not until Python has been fully hooked into LW. As of this moment it is not.


2. Is there a runtime speed advantage in Python code versus LScript code?

Not sure. We need one of the big brains to comment.


3. How reusable is the code from LW's Python really? If I wanted to run it in Maya, is that a trivial conversion or just as much effort as starting over?

I don't think that, other than any math algorithms, much if any code could be reused to Maya. UI API calls are completely different, along with any specific calls to either program.


Can anybody give me another good reason to switch to Python (except for "Lscript is dead", which it isn't for me at all)

Blochi

Future-proofing your scripts, perhaps? I don't think looking into Python now is a bad choice unless you just don't have time.

jeric_synergy
10-28-2012, 12:12 AM
Blochi, I'm not much of a programmer, but my examination of the state of LW+Python says: seems to me that Python right now is INCREDIBLY verbose+obscure, and won't really be practical unless:


1) users can write their own include files (?);
2) NewTek supplies extensive include files;
3) Documentation is improved and made more accessible to the casual programmer.

I may be misusing the term 'include files' here-- I mean Python libraries of functions that are easy to access.

"Practical" is not the same as "usable"-- Jen is already creating Python scripts: I also believe that #1 is already possible, although laborious, so users CAN build their own libraries to ease Python use, and I certainly hope #2 is in process. What's sad is the duplication of effort inherent in programmers all making their own libraries to address the same functionality.

There's also Bob Hood's (?) "LScript to Python" converter, which is supposed to be functional for the simplest of LScripts: from that, we should be able to make some judgements on speed comparisons between equivalent LScripts and Python scripts.

Blochi
10-28-2012, 12:24 AM
@BigHache: Thanks for your thoughts. Seen your intro movies (thanks for these, too) and so your opinion is valuable to me.

I'm not a naysayer, just trying to decide when to switch. I don't mean scripting for the fun and learning experience, but out of necessity in a studio environment. Just last week I whipped together a rather complex LScript that does exactly what I need, so I can use it right now. Took me only two days, because I can build on my own library of code snippets and functions.

Yes, LScript has annoying limitations. Like, it seems to be impossible to create a new channel group that resides within an object, or that an image filter script can only write pixel data into the RGB & Alpha channel but not individual render buffers. But those seem to be some sort of "final frontier" cases, compared to what I have seen in Python...

Future-proofing, well. LScripts always need some 3-year maintenance cycle and I doubt that Python scripts will be any different. Especially when the interpreter is still being written. In an odd way an LScript that I'm writing right now may even be more future-proof, because the syntax has solidified a while ago.

maxim capra
10-29-2012, 10:55 AM
regarding speed: i recently did some tests and found out, that in most cases, python seemed slower than lscript.... try for example the provided scripts lazy_points.py versus lazy_points.ls on the same geometry (something hi-res). they use the same code (the lscript version does not have an interface, but the variable for the lag rate is used in the code, too...) and the python version seems 5 times slower ... i even tried to clean up the python version but wasn't able to get big speed improvements ... so, all in all i'm currently pretty disappointed by todays status of the python implementation. let's see what the future brings ...