Skip to content

Python or c++

I was thinking of making a graphical calculator from scratch, i have some, but very little experience with python (that one 12h tutorial and a little more). Should i code it in c++ or is it fine if i do it in python?

From the nature of my project it requires a lot of computation and apparently c++ is like 100x faster, thats why im asking

3 points14 comments
Open on Reddit
About this post
Posted
Archived
Score
3 · 64% up
Kind
Text
ID
1v6eaad

Author

2
posts
2
comments
0
media
View profile

20 comments

Use one of the gajillion python libraries that is basically an API for a codebase written in C. Wham bam, problem solved. It's shrimple. Python the way God intended.

3 points
OkAccident9994Deleted · saved before deletion5 hidden

That is the best case scenario. And then the code is run like so:

-Python interpreter runs a line of code
-Calls a function in an external library that is just compiled C.
-Gets a result back
-Continues on and interprets the next line, if that is a new function call to the same external C library, we make a new separate call to it.

It is still gonna be slow as shit compared to running a program in C

It does not matter in the case of a calculator, that OP is asking about.

But we are on a games development subreddit.
Anyone who says anything positive about Python can suck my python.

3 points

This is the type of questions some newbies get slimed for bc "it's too basic"

Anyways, if it's a small personal project, I'd suggest u to go for python. A graphical calculator is pretty hard to make with that 12h tutorial alone, let alone with c++ bro. However, even though it is a pretty difficult task to do as a newbie, i have two things to say:

  • PLEASE do not use many tutorials (tutorial trap)

  • YOU DO NOT have to implement many features As soon as you add one more feature, you will feel the need to add more and more like a real graphical calc. even though you're (hopefully) doing this as a personal project and trying to have fun. It leads to development hell.

  • DO NOT RELY on reddit to give you advice, this subreddit gets REALLY toxic sometimes and one random toxic person can make you want to prove them wrong making you work on a project out of spite instead of out of fun. Instead, use Unity Learn and try to avoid using AI too much.

Stuff like this has happened to me in the wrong way and i gave up on so many projects bc i didnt know the stuff i mentioned.

1 points

Oh thanks man, everyone was reccomending that instead of watching tutorials i should just start a project and i want to use it as a tool for learning not actually bcs i think its gonna be any good

1 points
Total-Box-5169Deleted · saved before deletion

Take a look at Desmos Graphing Calculator, it is fully implemented in Javascript so it runs locally on your browser.
You can get the best performance and development speed with C++ since no other language provides so much control and abstraction power. However that requires a lot more effort to obtain true understanding of C++ and a good set of libraries. Unfortunately the standard libraries are not designed to maximize productivity, they are not comfy to use, don't support modern i/o like memory mapped files, and some data structures don't even provide the best performance.

1 points
unknown author

Deleted before we saved it.

1 points

Python has the ability to call C++ code if you need the performance.

Python is fine, but it sounds like Javascipt is better if you're making it web-based?

1 points
cbigelow879Removed · saved before deletion

They’re different types of languages. Python is high level, whereas C++ while technically high level is more halfway between high and low. As such, C++ tends to be harder to learn, and requires more coding and knowledge to do something.
That said, C++ can be faster IF DONE RIGHT. Because it’s sort of a lower level language, you have more nuanced control over executions, memory allocations, etc. than all of python’s built-in functionality - but u gotta know what you’re doing to benefit from it. Think of it like building a PC: you can go out and buy the parts and put it together and if u do it right ull get more bang for buck, but it takes more effort, more knowledge, and if u mess up you’ll wish you’dnjust bought Alienware :)

0 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.