Python slithers into Wesnoth
Posted Jan 15, 2009 0:51 UTC (Thu) by
qg6te2 (guest, #52587)
Parent article:
Python slithers into Wesnoth
1) No more memory-allocation screwups, *ever*. Python has no pointers and ...
While pointers are legal code in C++, one can also (and easily) write C++ code where their use is greatly minimised (if not completely eliminated).
... is garbage collected
Garbage collection is really a lazy solution for poor coding in C++. If a language (such as Python) needs it due to internal organisation, then so be it. However, ascribing garbage collection as a necessary part of every language is ill informed.
The complex tangle of standard and local custom memory allocators we presently use, and that are the source of so many of our bugs, will be chopped away as we move to Python -- and good riddance.
One can perfectly use only one allocator in C++. Moving to Python wholesale simply due to this issue is an insufficient reason. Perhaps a more productive approach would be stringent coding standards, where introducing Yet Another Allocator is forbidden.
2) I have observed Python code is between 2 and 5 times more compact than C/C++
Lumping C and C++ together is a mistake. They are two very different beasts, with a large gap in code compactness and type safety.
Performance is another concern, one that he glosses over with a breezy "machines are still getting faster"
The glossing over is also ill advised, as Python is not suited for any computationally intensive work unless the heavy lifting is done by external modules. While one can use Boost libraries to interface C++ code with Python, there is some loss in terms of type safety and efficiency (as objects may need to copied and/or converted).
Overall it appears that the motivation to move to Python is not due to technical reasons, but simply because Python forces a certain coding style. May I suggest that instead of converting from one language to another, the existing code is simply cleaned up ?
(
Log in to post comments)