All Questions
34 questions
17
votes
4
answers
8k
views
Why do some programmers categorize C, Python, C++ differently? - regarding level
I am taking an introductory course on python and the instructor says that python is a high level language and C and C++ are low level languages. It's just confusing. I thought that C, C++, Python, ...
6
votes
2
answers
649
views
When the stack frames become computationally expensive
I've been experimenting with different data structures and algorithms in Python, Java and C to see in what circumstances function/method inlining could bring meaningful gains in terms of the execution ...
3
votes
1
answer
419
views
Is C usually a last resort?
I've been learning C recently.
I've completed a number of coding challenges on websites like codewars in C, and I always find myself wishing I had something like Python's flexible data structures. In ...
37
votes
6
answers
25k
views
How to have two different programs with two different languages interact?
I don't know if this is too broad or not, but I am a youngish programmer still in college, its my Junior year. I feel like I have a pretty good grasps for different languages and have a pretty good ...
0
votes
2
answers
1k
views
How can Python, a language that supports Object Oriented Programming, be implemented in C, which is not an Object Oriented Programming language?
To my understanding, C does not have the concept of objects, then how can Python be implemented in C to support something that C can not? How is the concept of "Object" modeled in C? What is ...
-2
votes
1
answer
124
views
What should I use to graphically represent an object's position on a fixed path using python(preferred)?
Consider 2 roads merging into one(This map is supposed to remain fixed). The program will not generate this map. The program will read this map and plot positions on it on its own.
The python program ...
2
votes
2
answers
387
views
Loop complexity in C Vs Python
Just now I was reading a Python question on stack overflow, about clamping a list/array of results to be within a certain range.
Once of the more simple answers suggested something like:
...
27
votes
6
answers
27k
views
How to solve the problem of nested comments
It appears in not just one language that comments can't be nested. Do you have a good solution for this problem? One workaround in C/C++ and Java is to only use the single-line comment but it becomes ...
4
votes
1
answer
2k
views
Managing error code and error message mapping
As part of a game engine I am writing in cython, one of the challenges I am facing is creating a consistent interface for error handling that works at the C and python levels of my code. I am ...
-1
votes
1
answer
231
views
Possible motivation of having a minimal main function as in CPython source code?
I was recently looking through the CPython source code and noticed something rather intriguing:
/* Minimal main program -- everything is loaded from the library */
#include "Python.h"
#include "...
5
votes
6
answers
3k
views
Designing for an algorithm that reports progress
I have an iterative algorithm and I want to print the progress. However, I may also want it not to print any information, or to print it in a different way, or do other logic. In an object oriented ...
1
vote
3
answers
5k
views
How and why do we have underscores in variable naming
If I look in python code and sometimes maybe also in C codes, there is often two variables with the same name except for the underscore. For example two variables
variable1 data;
variable2 _data;
Why ...
0
votes
3
answers
1k
views
Definition of Generic function
1)
Below is a python function summation, that can perform sum of cubes/squares/.., similar operations.
def identity(k):
return k
def cube(k):
return pow(k, 3)
def square(k):
return ...
-7
votes
1
answer
498
views
Detect if code is C
I am currently using Python to write a compiler manager. I have to detect whether given source code is C, even if the code has a few syntax errors. I am currently using the file's extension to tell, ...
1
vote
4
answers
3k
views
Why use a higher level language? [closed]
A question that gets asked a lot is "Why use low level languages if you can code in high level languages more easily (and often tersely)?". I think the answers are fairly straight forward here, being ...