Questions tagged [python]

For questions about Python's design, or languages which are closely related to Python

Filter by
Sorted by
Tagged with
1 vote
2 answers
169 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?...
Ooker's user avatar
  • 175
6 votes
2 answers
349 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 ...
Jared Smith's user avatar
5 votes
3 answers
360 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 ...
Antonello's user avatar
  • 151
17 votes
6 answers
8k 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 ...
Ginger's user avatar
  • 2,579
2 votes
1 answer
476 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 ...
Ooker's user avatar
  • 175
9 votes
1 answer
1k 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: ...
Redz's user avatar
  • 900
11 votes
2 answers
863 views

How to transpile between languages with different scoping rules?

Suppose I have a block scoped language, in this case represented ...
mousetail's user avatar
  • 8,111
-5 votes
1 answer
169 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 ...
taylor.2317's user avatar
11 votes
4 answers
962 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....
Hemanth Haridas's user avatar
-4 votes
1 answer
124 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: ...
nchistov's user avatar
  • 1,585
4 votes
2 answers
201 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?
lyxal's user avatar
  • 1,775
7 votes
1 answer
148 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 ...
Ginger's user avatar
  • 2,579
-4 votes
2 answers
277 views

Why does Python not allow us to call functions like other languages do?

What many other languages do In many languages, I can have a function defined in a file called get_xyz.m (for example) and then other functions or scripts can use ...
Nike Dattani's user avatar
-3 votes
1 answer
221 views

In Julia, what is the benefit of requiring commas between elements when defining a vector for a dot product?

Introduction (Python, MATLAB/Octave, Julia) One of things about MATLAB/Octave that I find very convenient is the simplicity when defining vectors. For example: ...
Nike Dattani's user avatar