I was reading some Python code and saw these lines and couldn't figure out what's happening.
Here's the code:
class Connection():
(....)
.
.
.
def connect(name) -> Connection: ...
(....)
(....)
(....)
It's dummy code, it doesn't do anything, it just shows you what the setup and format is of functions and classes.
The writer created a class called Connection. Then, they made a function called connect which, I presume, creates an instance of the Connection class and creates a connection to a database, but it is a dummy function, so it doesn't currently do something until you program it to do that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.