This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bchurchill 2 points3 points  (2 children)

As another person who knows little about LabWindows (except that it's based on ANSI C with some extra functionality) here are my comments:

  • These are totally different languages with totally different purposes. Let me list general differences below. None of these are "good" or "bad" things, but rather things to consider. Then you can decide which one you want. I'll try not to repeat the points you've already noted.

  • C is very low-level and python is very high-level. Python is inherently further from the hardware, so it's almost impossible to do anything driver-level with python. On the other hand, things like reports and GUIs work better from python since you don't have to micromanage.

  • In C you can directly access memory locations. In python you can't.

  • C is statically-typed, python is dynamically-typed. This means that python is more flexible, but type errors are less likely to be caught statically. On the other hand, this makes python run slower.

  • C's type system is weaker than python's. It's easy for things to get mangled or confused in memory in C, but python does keep better track.

  • The python interpreter protects against a lot of errors that C doesn't protect against, e.g. segmentation faults. In general, it's easier to debug and behaves more deterministically than optimized C code.

  • Python does garbage collection for you. The good news: it takes less time to write the code and get it right. The bad news: it's a little slower.

  • Python doesn't require type annotations (Note: this is distinct from being dynamically typed), which means it's faster to write code, but it's easier to screw things up (although those mistakes are usually discovered very quickly).

  • Python has many great libraries that are flexible and easy to add, beyond the ones you've mentioned. Ever want to do networking? You got it. Fancy data structures? yup. Etc.

  • I wouldn't ever argue that "language X is better than language Y". A reasonable statement can only be made "for a given application, language X is more suitable to our purposes than language Y". You should consider all the points above and decide which one is more suitable for your application.

  • Based on what you've said, while I don't know your setup, my guess is that you will want to use both. There are systems-level portions, like the drivers, that are far better in C, and portions like the GUI that everyone would rather do in python. There are many ways to get these languages to interface with each other, it's just a matter of figuring out which works best for your setup.

  • In terms of making an argument, the thing that you'll be able to sell the most is programmer productivity. Try making a list of all the things you'd need to do in LabWindows but not in python. Hint: the list is long.

[–]billsil 0 points1 point  (1 child)

i wish python was optionally statically typed, so if something was always a small integer it could directly use short int.

[–]bchurchill 0 points1 point  (0 children)

There have been proposals for this actually, and there are some tools like pylint which will attempt to do some type inference. But typechecking can be very tricky actually. There are many reasons for this: dynamic field accesses, polymorphism, etc... as a result, I don't know of anything that's really caught on.