Mailing List Archive

How about using modern C++ in development of CPython ?
Hi all,

What about of using modern C++ in developing CPython ?

With C++ we can get the following benefits:
1) Readability - less code, most code is hidden by abstraction without losing performance
2) Maintainability - no code duplication in favor of using reusable classes
3) RAII - Resource Acquisition Is Initialization, predictable allocation and free resources
...
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/SMF4B2SOY6YG5BJCPEUNJVPNESA3MQOW/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
How does C++ fare in binary compatibility? Last time I checked it out (about 10 years ago), there was completely none, every compiler's ABI
was a black box without any guarantees whatsoever.
For any software that's going to dynamically link and exchange binary types with other independently produced software, that's a deal breaker.

On 24.03.2021 12:54, redradist@gmail.com wrote:
> Hi all,
>
> What about of using modern C++ in developing CPython ?
>
> With C++ we can get the following benefits:
> 1) Readability - less code, most code is hidden by abstraction without losing performance
> 2) Maintainability - no code duplication in favor of using reusable classes
> 3) RAII - Resource Acquisition Is Initialization, predictable allocation and free resources
> ...
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@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/SMF4B2SOY6YG5BJCPEUNJVPNESA3MQOW/
> Code of Conduct: http://python.org/psf/codeofconduct/

--
Regards,
Ivan

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/DRMTE4LZYHDGZXEAAUSD532TZPJKSTAV/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On Wed, 24 Mar 2021 19:45:49 +0300
Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
> How does C++ fare in binary compatibility? Last time I checked it out (about 10 years ago), there was completely none, every compiler's ABI
> was a black box without any guarantees whatsoever.
> For any software that's going to dynamically link and exchange binary types with other independently produced software, that's a deal breaker.

That depends if you use C++ internally or expose C++ bits in the public
API.
If you only use C++ internally, binary compatibility is presumably less
of an issue.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/GHYWBZY56CTPBOOQRVXCOXTO2EUHUZ3Z/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On 24.03.2021 19:58, Antoine Pitrou wrote:
> On Wed, 24 Mar 2021 19:45:49 +0300
> Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
>> How does C++ fare in binary compatibility? Last time I checked it out (about 10 years ago), there was completely none, every compiler's ABI
>> was a black box without any guarantees whatsoever.
>> For any software that's going to dynamically link and exchange binary types with other independently produced software, that's a deal breaker.
> That depends if you use C++ internally or expose C++ bits in the public
> API.
> If you only use C++ internally, binary compatibility is presumably less
> of an issue.

Python produces and accepts its internal types in API calls and allows extension modules to derive from them -- so it cannot "only use C++
internally" if those are going to become C++ types. (And if not, the point of using C++ is unclear.)

> Regards
>
> Antoine.
>
>
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@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/GHYWBZY56CTPBOOQRVXCOXTO2EUHUZ3Z/
> Code of Conduct: http://python.org/psf/codeofconduct/

--
Regards,
Ivan

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/7JIYJGSEL6RZM4FPNRSD3TMABO7YHT3D/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On Thu, 25 Mar 2021 20:22:55 +0300
Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
> On 24.03.2021 19:58, Antoine Pitrou wrote:
> > On Wed, 24 Mar 2021 19:45:49 +0300
> > Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
> >> How does C++ fare in binary compatibility? Last time I checked it out (about 10 years ago), there was completely none, every compiler's ABI
> >> was a black box without any guarantees whatsoever.
> >> For any software that's going to dynamically link and exchange binary types with other independently produced software, that's a deal breaker.
> > That depends if you use C++ internally or expose C++ bits in the public
> > API.
> > If you only use C++ internally, binary compatibility is presumably less
> > of an issue.
>
> Python produces and accepts its internal types in API calls and allows extension modules to derive from them -- so it cannot "only use C++
> internally" if those are going to become C++ types. (And if not, the point of using C++ is unclear.)

You can use C++ without exposing C++ types in the API. For example,
C++ templates could improve the maintainability of the generic
"stringlib" routines that are currently based on C macros. Another
example is using RAII in function bodies to help cleanup owned
references.

Regards

Antoine.


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/F7WX4SB4DV2GQJU2SXGXYLS7F3QJU3Q4/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On 25/03/2021 18.39, Antoine Pitrou wrote:
> On Thu, 25 Mar 2021 20:22:55 +0300
> Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
>> On 24.03.2021 19:58, Antoine Pitrou wrote:
>>> On Wed, 24 Mar 2021 19:45:49 +0300
>>> Ivan Pozdeev via Python-Dev <python-dev@python.org> wrote:
>>>> How does C++ fare in binary compatibility? Last time I checked it out (about 10 years ago), there was completely none, every compiler's ABI
>>>> was a black box without any guarantees whatsoever.
>>>> For any software that's going to dynamically link and exchange binary types with other independently produced software, that's a deal breaker.
>>> That depends if you use C++ internally or expose C++ bits in the public
>>> API.
>>> If you only use C++ internally, binary compatibility is presumably less
>>> of an issue.
>>
>> Python produces and accepts its internal types in API calls and allows extension modules to derive from them -- so it cannot "only use C++
>> internally" if those are going to become C++ types. (And if not, the point of using C++ is unclear.)
>
> You can use C++ without exposing C++ types in the API. For example,
> C++ templates could improve the maintainability of the generic
> "stringlib" routines that are currently based on C macros. Another
> example is using RAII in function bodies to help cleanup owned
> references.

C has ways to handle cleanup and ownership better -- at least some
compilers do. For example gcc has
__attribute__(cleanup(cleanup_function)) for automatic cleanup on scope
boundaries. If I recall correctly it works something like this:

void
Py_auto_decref(PyObject **o)
{
if (!o || !*o)
return;

Py_DECREF(*o);
*o = NULL;
}


PyObject *
func(PyObject self)
{
PyObject *spam __attribute__((cleanup(Py_auto_decref)));
...
Py_RETURN_NONE;
// spam gets automatically decrefed
}

It's too bad that the feature is not universally available in C99.

Christian

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/JGONDY5TRVTSCRMDUPPQH6OMEOAQ37Y2/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
@Christian Heimes

RAII is more than cleaning resource at the end of function, it is that while you are using class - resource will be available ...
You can move resource using modern C++ `std::move` ant lots of other features that could improve readability and maintainability of the code
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/NUKSLDAZ5FIZUE7NXZIGRJ64PTKJMKTQ/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
24.03.21 11:54, redradist@gmail.com ????:
> What about of using modern C++ in developing CPython ?
>
> With C++ we can get the following benefits:
> 1) Readability - less code, most code is hidden by abstraction without losing performance
> 2) Maintainability - no code duplication in favor of using reusable classes
> 3) RAII - Resource Acquisition Is Initialization, predictable allocation and free resources
> ...

The drawbacks:

1. You can only use C++ internally. All API should be in pure C. It
reduces possible benefits.
2. If you use C++, even internally, you have to link with libstdc++ and
use C++ compatible linker.
3. C++ is much much more complex than pure C. It drastically reduces the
number of available contributors and maintainers.

Also note that the C code it already written. The C++ code has yet to be
written, with chances to introduce new bugs during rewriting and
distracting resources from other tasks.

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/4X4QEE7IFR5WGKBSHMSNVVYWCS3VX4JW/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
The benefits:

1. You will link with high quality libstdc++ with lots of reusable containers without writing your own "buggy" one.
2. C++ is much much more maintainable than pure C. It drastically increase number of contributors that what like writing high quality and maintainable code without reinventing the wheel.

My personal stop of contributing in CPython is that it is written in pure C !!
I wrote code in both: pure C and C++, but I like writing code in C++, because it simplifies things without losing perfomance
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/YNVO3NM7J77AHVOPGCOTWZELTTHHA7YB/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On Sat, Apr 17, 2021 at 3:20 AM <redradist@gmail.com> wrote:
>
> The benefits:
>
> 1. You will link with high quality libstdc++ with lots of reusable containers without writing your own "buggy" one.
> 2. C++ is much much more maintainable than pure C. It drastically increase number of contributors that what like writing high quality and maintainable code without reinventing the wheel.
>

Citations please?

> My personal stop of contributing in CPython is that it is written in pure C !!

A lot of CPython is actually written in Python. There's plenty that
you can contribute to without writing a single line of C code, if you
so desire.

ChrisA
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/SWGOS4SA5IDUFRYSJRQQQR7RQPAP7RSK/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Chris Angelico wrote:
> On Sat, Apr 17, 2021 at 3:20 AM redradist@gmail.com wrote:
> > The benefits:
> >
> > You will link with high quality libstdc++ with lots of reusable containers without writing your own "buggy" one.
> > C++ is much much more maintainable than pure C. It drastically increase number of contributors that what like writing high quality and maintainable code without reinventing the wheel.
> >
> > Citations please?

What exactly do you what ?
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/ZQXWFCJYSN5YZTJCELFWUKBAPMROGIJP/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On Sat, Apr 17, 2021 at 3:32 AM <redradist@gmail.com> wrote:
>
> Chris Angelico wrote:
> > On Sat, Apr 17, 2021 at 3:20 AM redradist@gmail.com wrote:
> > > The benefits:
> > >
> > > You will link with high quality libstdc++ with lots of reusable containers without writing your own "buggy" one.
> > > C++ is much much more maintainable than pure C. It drastically increase number of contributors that what like writing high quality and maintainable code without reinventing the wheel.
> > >
> > > Citations please?
>
> What exactly do you what ?

Evidence for your statements. Otherwise, empty statements can be
rejected with empty rebuttals.

ChrisA
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/GEVDFX6CXJQXXZ2EZC3MZ6NV6FSFWGTH/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Hi,

I used C++ in the past to write a small game. My experience was that
the compilation was quite slow and many compiler errors were hard to
understand.

I love the fact the CPython is written in C because its build time is
under one minute for a fresh build, and way faster for an incremental
build (modifying a single C file).

I'm part of the "trial-and-error" church. I modify random parts of the
C code, build, test and repeat until it works as I want ;-)

A *fresh* build (after make clean) of CPython on my laptop (8 threads,
4 CPU cores) takes 13 seconds using make -j10 and gcc -O0. A fresh
build in release mode (make -j10 and gcc -O3) takes 44 seconds on the
same laptop.

CPython is made of around 500K lines of C code.

Victor

On Fri, Apr 16, 2021 at 7:19 PM <redradist@gmail.com> wrote:
>
> The benefits:
>
> 1. You will link with high quality libstdc++ with lots of reusable containers without writing your own "buggy" one.
> 2. C++ is much much more maintainable than pure C. It drastically increase number of contributors that what like writing high quality and maintainable code without reinventing the wheel.
>
> My personal stop of contributing in CPython is that it is written in pure C !!
> I wrote code in both: pure C and C++, but I like writing code in C++, because it simplifies things without losing perfomance
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@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/YNVO3NM7J77AHVOPGCOTWZELTTHHA7YB/
> Code of Conduct: http://python.org/psf/codeofconduct/



--
Night gathers, and now my watch begins. It shall not end until my death.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/PAIR6UTGNHYKGCTU3GRZSUVECJ2L2W3X/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Take a look at this video https://www.youtube.com/watch?v=D7Sd8A6_fYU
or read some articles ... otherwise I will need to spend too many time providing evidences to you and after all you will probably will reject anyway (because lots of people is biased and they even do not understand that, it is not about you, it is in general)
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/HFCMD2GHXP6MLGSYCEPSMJKA6J6723RH/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Guys, the issue is that I most of the time see that somebody used C++ for one or two times, did not understand it and left with bad taste ...

Please, answer me question, if you will go in gym two times, will you get stop training and say that it does not fit in your life ?
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/LWJ4WGWKVHG7CLRCSCBNR5ZKUORBMH6Z/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On 16/04/2021 19.39, Victor Stinner wrote:
> A *fresh* build (after make clean) of CPython on my laptop (8 threads,
> 4 CPU cores) takes 13 seconds using make -j10 and gcc -O0. A fresh
> build in release mode (make -j10 and gcc -O3) takes 44 seconds on the
> same laptop.

$ make clean
$ time make -j10
...
real 0m2,072s
user 0m4,715s
sys 0m2,333s

./configure -C and ccache are fantastic.

Christian

_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/LLDVGXNH32KDVVTT7NXIG7UOXHMW4WXB/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Anyone who has done a language change on a project knows that it is a huge disruption. You need solid justification to make such a change. All I have seen in this thread is personal opinion. Since this is a personal opinion exchange, I am of the humble opinion that the personal opinions of core devs matter the most, since a language change would affect them more than anyone else.

April 16, 2021 1:47 PM, redradist@gmail.com wrote:

> Guys, the issue is that I most of the time see that somebody used C++ for one or two times, did not
> understand it and left with bad taste ...
>
> Please, answer me question, if you will go in gym two times, will you get stop training and say
> that it does not fit in your life ?
> _______________________________________________
> Python-Dev mailing list -- python-dev@python.org
> To unsubscribe send an email to python-dev-leave@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/LWJ4WGWKVHG7CLRCSCBNR5ZKUORBMH6Z
> Code of Conduct: http://python.org/psf/codeofconduct
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/3K3FDADSIFH7WJEKFNNYWFDTCZGZFKBI/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On 16/04/2021 19.14, redradist@gmail.com wrote:
> My personal stop of contributing in CPython is that it is written in pure C !!
> I wrote code in both: pure C and C++, but I like writing code in C++, because it simplifies things without losing perfomance

There are plenty of Open Source projects that could use more capable C++
developers. :)

I'm not a fan of C++. It has its use cases, e.g. in UI. Python core
isn't the best fit. AFAIK most core devs are not fluent in C++. Despite
it's name, C++ is really a different language than C. It has a different
ABI and stdlib than C, too. In my personal opinion C++ won't give us any
net benefits. I'd much rather go for Rust than C++ to gain memory safety.

Christian


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/2HTFWK3JXOTCENWOVW6TYAZPIBP3HR76/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On 4/16/21 10:27 AM, redradist@gmail.com wrote:
> Chris Angelico wrote:
>> On Sat, Apr 17, 2021 at 3:20 AM redradist@gmail.com wrote:
>>> The benefits:
>>>
>>> You will link with high quality libstdc++ with lots of reusable containers without writing your own "buggy" one.
>>> C++ is much much more maintainable than pure C. It drastically increase number of contributors that what like writing high quality and maintainable code without reinventing the wheel.
>>>
>>> Citations please?
>
> What exactly do you what ?

A list of current Python containers that are already in C++, that work exactly as our C ones do (otherwise, we will have
had to add code to make them work as we want, and surely that will introduce bugs).

Examples of how C++ is more maintainable.

A poll of users that love C++ enough to contribute to CPython because we also use C++, combined with a poll of users
currently contributing C code that would stop because they don't know/like C++.

We should also have evidence that C++ is available on all supported platforms that we support CPython on.

--
~Ethan~
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/DKC4UKYGLJJQX3N3EOBQYROMHV7FZKMA/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On 4/16/21 10:43 AM, redradist@gmail.com wrote:

> Take a look at this video https://www.youtube.com/watch?v=D7Sd8A6_fYU
> or read some articles ... otherwise I will need to spend too many time providing evidences to you and after all you will probably will reject anyway (because lots of people is biased and they even do not understand that, it is not about you, it is in general)

You are the one proposing the change, so it's up to you to provide the evidence for it. If you aren't willing to put in
a few hours for that effort, why should we put the weeks and months to port the code over?

--
~Ethan~
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/OBZU7R2ORXXF3FSJL55TX4SRR7G7KZP2/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
edwin?211mainstreet.net wrote:
> Anyone who has done a language change on a project knows that it is a huge disruption. You need solid justification to make such a change. All I have seen in this thread is personal opinion. Since this is a personal opinion exchange, I am of the humble opinion that the personal opinions of core devs matter the most, since a language change would affect them more than anyone else.
> April 16, 2021 1:47 PM, redradist@gmail.com wrote:
> > Guys, the issue is that I most of the time see that somebody used C++ for one or two times, did not
> > understand it and left with bad taste ...
> > Please, answer me question, if you will go in gym two times, will you get stop training and say
> > that it does not fit in your life ?
> > _______________________________________________
> > Python-Dev mailing list -- python-dev@python.org
> > To unsubscribe send an email to python-dev-leave@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/LWJ4WGWK...
> > Code of Conduct: http://python.org/psf/codeofconduct
> >

Okay lets try to discuss one by one:
1) Readability - less code, most code is hidden by abstraction without losing performance
In CPython code lots of stuff like Py_INCREF, Py_DECREF .. it could be fixed with C++ std::shared_ptr<> (RustPython use analog Arc<>)

2) Maintainability - no code duplication in favor of using reusable classes
In CPython I saw custom lists and stacks and so on ... with C++ it could be switched to std::list<>, std::stack<> and so on
In CPython lots of custom implemented algorithms that could be changed by using C++ <algorithms> that support lots of types !!

3) RAII - Resource Acquisition Is Initialization, predictable allocation and free resources
Also reusable peaces of code will help of maintaining life-time of objects with RAII, not only at the end of function, but in general, because life-time resource will be bound to object life-time
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/HCZBCLFRQGPKRGJ5JAVIMOWBBLMSNOVG/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Ethan Furman wrote:
> On 4/16/21 10:43 AM, redradist@gmail.com wrote:
> > Take a look at this video https://www.youtube.com/watch?v=D7Sd8A6_fYU
> > or read some articles ... otherwise I will need to spend too many time providing evidences to you and after all you will probably will reject anyway (because lots of people is biased and they even do not understand that, it is not about you, it is in general)
> > You are the one proposing the change, so it's up to you to provide the evidence for it. If you aren't willing to put in
> a few hours for that effort, why should we put the weeks and months to port the code over?
> --
> ~Ethan~

I do not ask porting code, I ask using new code with C++ and if code was tested enough to reimplement it in C++ with RAII, <algorithms>

Also I suggest using C++ excepting that most of the people here now it ... It was not intended to teach C++ here, especially in Mail List )))

And reason why you at least should try learn other languages, it is because it will make you better developer
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/7MLCM7DKBAPMBBIRWZHHTOGL76GPIYWM/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
April 16, 2021 2:08 PM, "Denis Kotov" <redradist@gmail.com> wrote:

> edwin?211mainstreet.net wrote:
>
>> Anyone who has done a language change on a project knows that it is a huge disruption. You need
>> solid justification to make such a change. All I have seen in this thread is personal opinion.
>> Since this is a personal opinion exchange, I am of the humble opinion that the personal opinions of
>> core devs matter the most, since a language change would affect them more than anyone else.
>> April 16, 2021 1:47 PM, redradist@gmail.com wrote:
>> Guys, the issue is that I most of the time see that somebody used C++ for one or two times, did not
>> understand it and left with bad taste ...
>> Please, answer me question, if you will go in gym two times, will you get stop training and say
>> that it does not fit in your life ?
>> _______________________________________________
>> Python-Dev mailing list -- python-dev@python.org
>> To unsubscribe send an email to python-dev-leave@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/LWJ4WGWK...
>> Code of Conduct: http://python.org/psf/codeofconduct
>
> Okay lets try to discuss one by one:
> 1) Readability - less code, most code is hidden by abstraction without losing performance
> In CPython code lots of stuff like Py_INCREF, Py_DECREF .. it could be fixed with C++
> std::shared_ptr<> (RustPython use analog Arc<>)

So every single python extension library would have to be rewritten to handle all the new C++ apis? Sounds like an idea everyone will be very excited about.
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/52YMBBM5NWZPYZ7X57O2ETKWD22DLQ3K/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
On Fri, 16 Apr 2021 18:08:58 -0000
"Denis Kotov" <redradist@gmail.com> wrote:
>
> Okay lets try to discuss one by one:
> 1) Readability - less code, most code is hidden by abstraction without losing performance
> In CPython code lots of stuff like Py_INCREF, Py_DECREF .. it could be fixed with C++ std::shared_ptr<> (RustPython use analog Arc<>)

std::shared_ptr<> would be a bad replacement for CPython's reference
counting for two reasons:

1) the reference count is maintained in a separate memory block (unless
you were careful enough to use std::make_shared() for allocation)

2) the reference count is atomic, and this has been proven to slow down
CPython by 10-20%.

That does not mean that CPython couldn't benefit from C++-based
abstractions, but they would have to be implemented (or taken from
another project such as pybind11).

Regards

Antoine.


_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/YEXWX6NT5W533PFIJVXAKHQWJCY43BDZ/
Code of Conduct: http://python.org/psf/codeofconduct/
Re: How about using modern C++ in development of CPython ? [ In reply to ]
Antoine Pitrou wrote:
> On Fri, 16 Apr 2021 18:08:58 -0000
> "Denis Kotov" redradist@gmail.com wrote:
> > Okay lets try to discuss one by one:
> >
> > Readability - less code, most code is hidden by abstraction without losing performance
> >
> > In CPython code lots of stuff like Py_INCREF, Py_DECREF .. it could be fixed with C++ std::shared_ptr<> (RustPython use analog Arc<>)
> > std::shared_ptr<> would be a bad replacement for CPython's reference
> counting for two reasons:
> 1) the reference count is maintained in a separate memory block (unless
> you were careful enough to use std::make_shared() for allocation)
> 2) the reference count is atomic, and this has been proven to slow down
> CPython by 10-20%.

Rust have 2 ref count classes Rc and Arc.
First is without atomic, single threaded, second is with atomic and could be used in multiple thread.
It is possible to implement the same std::ref_ptr like Rc without atomic variables
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-leave@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/BOYTNQSCUXBWHUXZFE7RZSBWQQZZRZ5M/
Code of Conduct: http://python.org/psf/codeofconduct/

1 2 3  View All