All Questions
34 questions
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 ...
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:
...
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 "...
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 ...
-1
votes
2
answers
576
views
How are complex programs made? [duplicate]
I know a few languages, and can program in them. How do multiple languages blend together in a single program? For ex. https://github.com/facebook/watchman. This uses C, PHP, Python, Javascript, etc. ...
0
votes
3
answers
1k
views
Socket Connecting to Large number of IPs
I have a text file of ~600 CIDR notation IP blocks which, when expanded, amount to ~17.5M IP addresses. I need to socket connect to each one. If it connects, I add it to a "live" list, if it returns ...
0
votes
2
answers
792
views
What are and how do (data-) types work?
What is a "variable"/data type?
How does a compiler / interpreter handle types?
My specific concern has to do with the different types in lower and higher level languages. For instance in Python, as ...
1
vote
2
answers
1k
views
Languages implemented in Python?
AFAIK, Scala and Clojure are implemented in Java and Java is implemented in C. I suppose that many or most languages are implemented in C, for instance Perl, Python and SQL. I don't know much about ...