[Python-Dev] Re: How about using modern C++ in development of CPython ?
Stephen J. Turnbull wrote: > Denis Kotov writes: > > Usually people say that C++ not fit in CPython not knowing C++, > > That's not the issue. There are plenty of people who know C++ who say > the benefits of C++ are not worth the bugs, the effort, and the plain > old churn that a rewrite in C++ (even if incremental) would require. I am not sure about this one ... For example, PyObject is much better to implement using C++ class, it will bring RAII that will reduce number of issues not free memory in CPython See: https://youtube.com/clip/UgkxyNe_dsZKinT_RT3UGb-BaP0SnvKteo2o Without RAII - introduced the most dangerous errors !! ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/7LNKR4P3TKNBOFWQMNLIDHH3NYAU5H6I/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: How about using modern C++ in development of CPython ?
Denis Kotov writes: > For example, PyObject is much better to implement using C++ class, > it will bring RAII that will reduce number of issues not free > memory in CPython Well, yes, that's the C++ Kool-Aid we're all supposed to drink. But it has its costs, too. How does it affect performance? How does it interact with slots, __new__, metaclasses, and other features of the Python class hierarchy, especially when coded as C? What about translating all of the accelerated modules written in C using the existing stable ABI? Have you looked at how this would affect NumPy, Pandas, and cffi? That's just a bunch of random related software, there are plenty of others (not to mention non-public software that neither of us has access to that may be affected). Really, you need to bring new information specific to Python rather than this generic "C++ is great" advocacy. > See: > https://youtube.com/clip/UgkxyNe_dsZKinT_RT3UGb-BaP0SnvKteo2o No thanks, if it's not text I'm not going to look at it. I don't have time to watch videos with no explanation, and best guess is 90% of it I already know, just as I don't think you've yet written anything I didn't already know. > Without RAII - introduced the most dangerous errors !! List the CVEs. I'll happily go read those! Steve ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/67LM5JNOLSI4NASTXRTF4JXT6JMN2UFO/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: How about using modern C++ in development of CPython ?
Stephen J. Turnbull wrote: > Denis Kotov writes: > > See: > > https://youtube.com/clip/UgkxyNe_dsZKinT_RT3UGb-BaP0SnvKteo2o > > No thanks, if it's not text I'm not going to look at it. I don't have > time to watch videos with no explanation, and best guess is 90% of it > I already know, just as I don't think you've yet written anything I > didn't already know. It is just 10-20 seconds, I used YouTube Shorts to slice it :) ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/OYVZG7ZDPO6IYTQSV4YP5S56A3RKRIVC/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: How about using modern C++ in development of CPython ?
On Mon, 17 Oct 2022 at 11:20, Denis Kotov wrote: > Stephen J. Turnbull wrote: > > Denis Kotov writes: > > > See: > > > https://youtube.com/clip/UgkxyNe_dsZKinT_RT3UGb-BaP0SnvKteo2o > > > No thanks, if it's not text I'm not going to look at it. I don't have > > time to watch videos with no explanation, and best guess is 90% of it > > I already know, just as I don't think you've yet written anything I > > didn't already know. > > It is just 10-20 seconds, I used YouTube Shorts to slice it :) > So while I agree with Stephen that if someone expects me to watch a video I almost certainly won't (no matter how short) I watched this, just to make the point. And indeed, it says nothing that I (and I imagine Stephen) didn't know, and all it does is list a bunch of vulnerabilities and assert that C++ can help with these. And it's presented by Herb Sutter, so yes, I'm sure he knows what he's talking about. And indeed, I know C++ so I can confirm that C++ has idioms and language features that you can use to help with mitigating these vulnerabilities. But it's not a magic wand, you still have to write the code to use these features. You can write pure C code in C++, so there's no instant fix here, you have to **change the code** to gain the benefits you suggest. If you don't have a *specific* explanation of how Python can be improved by rewriting it in C++, that takes into account all of the costs of such a rewrite, then you won't get anywhere here. I could just as easily say "yay, Rust is great, let's use Rust". Or if you're that convinced, do the work. Make a fork of Python that uses C++ instead of C, demonstrate that it's (in whatever way you want to measure) "better" than the existing implementation, and be prepared to defend that position. That's what multiple people have done, when suggesting ways to speed up Python, ways to remove or mitigate the GIL, etc. That route *works*, if your argument is sound. But just saying "you should do X" and expecting people to just do the work for you is almost certainly *not* going to work. Paul ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/MIZGXZ3S6V52SPW3EH7Z76YCBDFZVJNM/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: How about using modern C++ in development of CPython ?
CPython is written (mostly) in C. There's Jython written in Java. There also IronPython written on C#. Feel free to write your own Python implementation in C++. Could be fun! ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/TF2ODTVTNJFMPXJJKSISHFGGRDNXDYMR/ Code of Conduct: http://python.org/psf/codeofconduct/
[Python-Dev] Re: How about using modern C++ in development of CPython ?
On 17/10/22 10:13 pm, Denis Kotov wrote: For example, PyObject is much better to implement using C++ class, I used to think this. Python has OO features, C++ has OO features, should be a good match, right? Well, no. Python's OO is very flexible and dynamic, C++'s is very rigid and static. CPython uses various low-level tricks that rely on structs being just "plain old data". The OO features of C++ wouldn't help nuch with that at all, and would often get in the way. If you want a Python implementation that's less prone to memory management errors, I would suggest having a small kernel written in C, and write the rest using a tool similar to Cython that will take care of all the tricky reference counting for you. -- Greg ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/7SHARSLCRFH4XOJAQOOBG4O5XVQE2CH7/ Code of Conduct: http://python.org/psf/codeofconduct/