'Declare a global variable with certain type
In python, is it possible to declare a global variable with a type? I know this is fine to declare a local variable like this.
student: Student
Or
global student
But I'm looking for something like this
global student: Student
Solution 1:[1]
There are no set types for python variables, so you just need to declare global variable - which would automatically be any variable declared outside of a function scope.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | SergeyA |
