Cro3SwI2mer / Bradford-Research-Project

Research project carried in Advanced Automotive Analytics center in University of Bradford
0 stars 0 forks source link

PEP 498 -- Literal String Interpolation support #1

Open oogl opened 3 years ago

oogl commented 3 years ago

f-strings are more convenient for reading the code in the majority of cases. They are also speed-optimized. Exceptions: backslashes may not appear inside the expression portions of f-strings.

Examples:

  1. This line will change from

    print("Last compilation:", str(datetime.datetime.now()))

    to

    print(f'Last compilation: {datetime.datetime.now()}')
  2. This one from

    self.dataframe[str(column) + '_dtf'] = pd.to_datetime(self.dataframe[column])

    to

    self.dataframe[f'{column}_dtf'] = pd.to_datetime(self.dataframe[column])

and so on.