Questions tagged [python]
For questions about Python's design, or languages which are closely related to Python
17 questions
1
vote
2
answers
273
views
How can I design a simple programming language from scratch? [closed]
want to design a simple programming language for educational purposes.
My goal is to understand the fundamentals of how a language works — defining syntax, grammar, and how code gets executed (...
12
votes
4
answers
5k
views
Why not make all keywords soft in python?
In Python we have the concept of a soft keyword, which makes some keywords reserved only in some special cases (e.g. match, case ...
3
votes
1
answer
395
views
How is a python namespace implemented in terms of memory under Cpython implementation? [closed]
I am confused about the implementation of a global namespace in python .
How are variable names mapped as keys to the objects they reference as values ,since namespace is implemented as a dictionary? ...
1
vote
2
answers
993
views
What is the difference between JS's map and Python's dictionary?
It seems that JS's map and Python's dictionary are equivalent. Is that correct? And if so, why they aren't called the same? Given that JS is newer, why wouldn't the map be called as dictionary as well?...
7
votes
2
answers
628
views
Why does python allow single-line compound statements?
I came across this question on Stack Overflow and it got me wondering... why did Python choose to allow single line compound statements? Python has significant whitespace, and it seems like the parser ...
5
votes
3
answers
805
views
How JIT in R compares to JIT in Julia and JIT in Python?
How the implementations of JIT in R, Python and Julia differs? Are there characteristics of the language that make the compiler's job harder or less efficient in some language compared to others?
On a ...
16
votes
6
answers
11k
views
Does Python's semicolon statement ending feature have any unique use?
Python does not usually use explicit line-ending characters; the parser can almost always figure out where a statement ends from the positioning of newlines. However, Python's syntax allows you to use ...
2
votes
1
answer
601
views
Is it correct that Python does not encourage us to read objects's content? [closed]
After playing around Python a little bit, I feel like Python does not encourage us to read objects's content. Take JavaScript for example: just a simple act of calling an object will list all the ...
10
votes
1
answer
3k
views
In Python, why isn't it a syntax error when a list of strings is defined without comma separators?
When coding in Python, I found that defining a list of strings without separating the strings with a comma is not a syntax error. When running this code:
...
11
votes
2
answers
908
views
How to transpile between languages with different scoping rules?
Suppose I have a block scoped language, in this case represented
...
-5
votes
1
answer
234
views
Are you allowed to use almost identical language to another language? [closed]
In Python, you use the term print. If there was another language that worked in the exact same way as Python, but used slightly different terms (like ...
12
votes
4
answers
3k
views
Why does Python ignore type hints?
In Python, everything is treated as an object. This means that CPython interpreter will decide on the fly, what is the type of each variables or the function return type depending on the current state....
-4
votes
1
answer
206
views
Does CPython compile the entire code or one piece at a time? [closed]
Does it:
first compile all the code into bytecode, and only then executes it,
or does it compile the minimum possible piece of code and executes immediately?
For example, this code:
...
5
votes
2
answers
536
views
What benefits does Python gain from not having constants?
A lot of languages have some form of constant variables - hell, even JavaScript has them.
Yet Python doesn't. What possible benefits does this have for the Python language?
7
votes
1
answer
231
views
What are the advantages and disadvantages of package declarations?
Java-family languages often use a package declaration at the top of a source file, to group source files into modules/packages independently of their file system ...