Does Python emphasize bad practice?

I recently realized that we can use the following as a shorthand for repr(x) in Python:

 `x` 

However, I rarely saw this in practice. Is this considered bad practice or unwritten? Or are there other reasons for which it is rarely used?

+4
source share
1 answer

I don’t think many people claim that it is Pythonic, especially because it was removed from Python3

Before that, I would never use it in real code. The problem is that many developers did not know what it was for, and it is not very easy to find.

In Python3, the .__next__() method was also moved instead of .next() for iterators, which reinforces the idea that repr(x) calls x.__repr__() , etc.

+5
source

Source: https://habr.com/ru/post/1439043/


All Articles