All Questions
8 questions
28
votes
4
answers
16k
views
Is colon in python blocks technically necesary?
This is really just a theoretical question by a python newbie who wants to understand more.
I keep forgetting the colon after the block initial statements in python. Those are what I mean:
for <...
5
votes
2
answers
11k
views
How to generate C++ code? (probably WITH (not FROM) Python) [closed]
For a scientific simulation I need to write some computations in C++. Since this became extremely tedious, I built myself a small code generator: In a scripting language (Python) you put together a ...
0
votes
2
answers
3k
views
Nested functions; allow or not? [closed]
Having programmed a whole lot in python, using nested functions is a good way to not clutter the namespace with small helper functions that are only used once.
Now I'm programming in go, and upon ...
-4
votes
3
answers
3k
views
Why different languages have different syntax? [duplicate]
Different programming language always/most of the time use different syntax.
For example take PHP, Java and Python.
In Php & Java semicolons are compulsory at the end of the line, yet Python ...
0
votes
1
answer
104
views
Why do objects created with no assignment not generate a syntax error in Python?
While working on a Python project, I realized that during my editing I had left a string floating around in the middle of my code and it didn't generate an error. For example, these few lines execute ...
2
votes
1
answer
237
views
What exactly is this Python statement doing?
I'm trying to port a very basic dual contouring algorithm written in Python (here) to C++. I'm not a Python programmer so some of the language syntax is a bit foreign to me.
Specifically, this block ...
100
votes
5
answers
272k
views
Why store a function inside a python dictionary?
I'm a python beginner, and I just learned a technique involving dictionaries and functions. The syntax is easy and it seems like a trivial thing, but my python senses are tingling. Something tells me ...
5
votes
8
answers
1k
views
Confusion regarding def function within Python
I've been learning Python for about 2 months now (Started with Learn Python The Hard Way, now reading Dive Into Python), and within both books, I still seem to be confused over this one bit of code.
...