Turbocharge your Python development with the latest release of PyScripter!


PyScripter understands type hints

The forthcoming version of PyScripter supports python 3 type hints. The main use of type hints by pyscripter is to improve code completion.  See for instance the following example.  (shame blogger does not provide code formatting)

class Airport:
    def __init__(self, name:str):
      self._name = name
    def location(self) -> str:
        return self._name
class Flight:
    def __init__(self, origin:str, dest:str):
        self.origin = origin
        self.dest = dest
class Plane:
    def do_flight(self, fligth:Flight):
        origin = fligth.origin  #code completion flight.
        dest = fligth.dest
        print(“I am flying from {origin} to {dest}”.format(origin=origin, dest=dest))
def catch_plane() -> Plane:
    return Plane();
Venizelos = Airport(“Athens”)
Fiumicino = Airport(“Rome”)
plane = catch_plane()
plane.do_flight(Flight(Venizelos.location, Fiumicino.location)) #code completion plane.

If you want full type checking of your code you can setup mypy as an external tool.

Leave a Reply