Python Forum
Reasons to choose Python over C++? - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Reasons to choose Python over C++? (/thread-3047.html)

Pages: 1 2 3 4 5 6 7


RE: Reasons to choose Python over C++? - volcano63 - Apr-28-2017

One of the biggest arguments against Python compared to C++ - or any compiled fixed-type language - that I can make is that Python hides real data types. When you use integer, you are seldom aware how many bytes of code it occupies. You may stumble on encoding issues, but you don't care how many bytes is each character in your string. This thread is a good indication.

I actually stumbled on that issue at a job interview last summer, when I was asked to write a test for Fibonacci function that will check that the return value remains positive. And, being used to Pythonic tolerance, I did not think about possible overflow in 4 or 8-byte integer.....


RE: Reasons to choose Python over C++? - micseydel - Apr-28-2017

(Apr-28-2017, 05:42 PM)volcano63 Wrote: I actually stumbled on that issue at a job interview last summer, when I was asked to write a test for Fibonacci function that will check that the return value remains positive. And, being used to Pythonic tolerance, I did not think about possible overflow in 4 or 8-byte integer.....
What? You shouldn't have to think about that, how is it a problem?


RE: Reasons to choose Python over C++? - volcano63 - Apr-28-2017

(Apr-28-2017, 05:44 PM)micseydel Wrote: What? You shouldn't have to think about that, how is it a problem?
Exactly - it's not a problem in Python. In C it may be. And understanding that limitation when working against C libraries may be important on occasion.

Pure Python spoils you  Tongue - you take for granted many things that are not important implementation-wise. But I still will rather write Python Thumbs Up


RE: Reasons to choose Python over C++? - wavic - Apr-28-2017

The people who never programпed before have one advantage over the others who have experience with another language. They don't spend even a second wondering why this or that works that way.

I have touched C before. For a while. I had some obstacle understanding how the for loop works. And was doing as many other people do:


for i in range(len(list_)):

    print(list_[i])
The interesting part of all of that is that I didn't try to program something for 10, maybe 15 years. But when I've started with Python this just has popped out. It was like imprinted in my brain.
And I am not a professional programmer and never was. I can't event imagine how confusing could be for someone who is a programmer for a long-long time.


RE: Reasons to choose Python over C++? - micseydel - Apr-28-2017

(Apr-28-2017, 07:13 PM)wavic Wrote: I can't event imagine how confusing could be for someone who is a programmer for a long-long time.
There comes a point at which you have at least passing familiarity with enough languages that it stops being as hard. As part of my CS degree, I also took two terms of "programming languages" coursework that helped formalize a lot of things for me. I forget most of it, but there was a lot about dynamic dispatch, scope (which some people thing is defined in Python with indentation, which is not true), paradigms like procedural, functional and declarative, etc. The middlepoint is worse than the long-term.


RE: Reasons to choose Python over C++? - nilamo - Apr-28-2017

(Apr-28-2017, 07:13 PM)wavic Wrote: I can't event imagine how confusing could be for someone who is a programmer for a long-long time.

It's only an issue for the first few languages.  Once you've at least dipped your feet in the different types of languages (static, dynamic, functional, etc), then picking up a new language can be done in a weekend.  First you look at the syntax to see how it compares to what you already know, then you look at idiomatic ways to do things in the language, and boom, you're writing code that people who use the language full time would cringe at.

For example, if you've used c/c++ before, even a small amount, then doing almost anything in php is drop dead simple.  Since you know python, you could probably pick up ruby in under 3 hours.

At a certain point, you stop thinking "how do I do x", and more like "I can do x using y... what's the best way to do y in this language?"  Which makes googling very easy.


RE: Reasons to choose Python over C++? - micseydel - Apr-28-2017

I want to clarify on top of nilamo's post that to pick up a language in a few hours or even a weekend is some novice degree of productivity. To learn idioms takes more time. Learning Scala, I would say, was one of the hardest things I have ever learned. But a tutorial on the basics could get me as productive as I was with Java in a small number of hours, and then more hours to learn idioms and advanced features (like pattern matching).


RE: Reasons to choose Python over C++? - Ofnuts - Apr-28-2017

(Apr-28-2017, 11:18 AM)zivoni Wrote:
(Apr-28-2017, 10:44 AM)wavic Wrote: I know one thing about Perl. It's the only language that looks the same before and after encryption. Big Grin

You should check APL family - for example K. And thats language that is used, not esoterical language like Befunge or Malbolge.

Perl and APL are both write-only languages. But at least APL makes no secret of this.


RE: Reasons to choose Python over C++? - Larz60+ - Apr-28-2017

Quote:Perl and APL are both write-only languages
so true. A week after writing perl scripts, I couldn't figure out what they did.


RE: Reasons to choose Python over C++? - RandoomDude - Apr-29-2017

You know what,i am quiting python.on windows python uses the batch script to open an application.I am moving on to vb.net.v