There is a notion of Programming Into vs. Programming In a language, which is tightly associated with the underlying paradigms supported by programming languages. When developers switch languages, they usually focus on technicalities without trying to truly embrace the core ideas and style of the target language. The outcome is a code that perfectly "runs” but looks strange and unnatural. A fine example is the official Python 3 solution to the Verifying an Alien Dictionary problem. It resembles a typical imperative procedural style of programming instead of being pythonic. To make this advice and discussion concrete, here is the version that follows Python's succinct way of writing down programs.
class Solution:
def isAlienSorted(self, words: List[str], order: str) -> bool:
alphabet = {letter: position for position, letter in enumerate(order)}
@lru_cache(maxsize=100)
def encode(word):
return tuple(alphabet[letter] for letter in word)
return all(encode(words[i]) <= encode(words[i + 1]) for i in range(len(words) - 1))The memoization of encode is needed to avoid doing the same work twice. The above code has equal performance as the more verbose procedural variant but is terser and relies on Python's built-in features (like, tuples). The latter ensures higher quality as there is less chance to introduce a bug.
As a corollary, spend time to study the inherent ideas of your programming language and strive to be exposed to as many paradigms as you can. This will make you a better programmer even if you will all the time use the same language.