Python Forum
Reasons to choose Python over C++?
Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Reasons to choose Python over C++?
#41
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.....
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#42
(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?
Reply
#43
(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
Test everything in a Python shell (iPython, Azure Notebook, etc.)
  • Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
  • Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
  • You posted a claim that something you did not test works? Be prepared to eat your hat.
Reply
#44
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.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#45
(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.
Reply
#46
(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.
Reply
#47
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).
Reply
#48
(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.
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply
#49
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.
Reply
#50
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Mac os choose file name howard687 1 1,868 Jan-05-2022, 06:54 AM
Last Post: Larz60+
  Loop with choose Irv1n 5 3,239 Sep-16-2021, 09:31 PM
Last Post: deanhystad
  Choose an element from multidimensional array quest_ 2 2,647 Nov-25-2020, 12:59 AM
Last Post: quest_
  Need help implmenting if/else or case statements for option to choose file format. samlee916 1 2,019 Jul-22-2020, 06:06 PM
Last Post: Larz60+
  Choose your own adventure game noahc2004 2 2,581 Jun-26-2020, 02:06 PM
Last Post: DPaul
  Please help a newbie choose which programming language to learn. yeto 2 3,503 Feb-25-2019, 12:56 AM
Last Post: yeto
  User Input to Choose from Dictionary anelliaf 9 25,810 Mar-27-2018, 02:22 PM
Last Post: anelliaf
  Need a little more help in a Choose Your Own Adventure Program Goldberg291 13 18,524 Jan-31-2017, 08:33 AM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020