-2

All,

Can you please tell me what this line means in Python? I don't know if I'm using it properly.

def read_places_file(filename) -> List[PlaceInformation]:

We are defining a method that takes a parameter called, 'filename'. And then what does the rest of the line mean? What does the '->' operator mean?

Thank you very much in advance.

  • They are type hints, they allow IDE's and other tools to better analyze and infer types, and allow for things like autocompletion. See [PEP 484](https://www.python.org/dev/peps/pep-0484/) – President James K. Polk Nov 12 '18 at 16:52

1 Answers1

1

Those are type annotations indicating the format of the function's output.

robsberg
  • 11
  • 2
  • Ok, I think I understand. So, after the function is run, the 'return' should be a list of 'PlaceInformation" objects? – Peesha_Deel Nov 12 '18 at 16:53