Understand Python dot operator by R programmers

Antonio Ercole De Luca
1 min readDec 10, 2019

--

Today I stumbled across on a possible event that can lead an experienced R programmer who is learning python to completely misunderstand its syntax.

The problem arises since the R programming language allows the use of the . (dot) character inside variables definition. Instead, many programming languages, such as C, Java and Python interpret the . (dot) character as an operator, such as the plus (+ character) operator.

Here’s an example, where a new function is defined with the name plot.lpp:

plot.lpp <- function(x, ...) { ... }

As this Cross-validated response explains, there is additional meaning when a function is defined with the dot character inside its name.

On Java and Python the dot operator is related with Object Oriented Programming. If you want to know more about the dot operator on python I found out an interesting and concise guide for the ones already knowing R language: here.

--

--

No responses yet