0

I use python3.7 and i had see someone use code like this

import mitmproxy.log
import mitmproxy.master
import mitmproxy.options

log: "mitmproxy.log.Log"
master: "mitmproxy.master.Master"
options: "mitmproxy.options.Options"

is mean that log is an instance of mitmproxy.log.Log?
But i try terminal, error occured

In [8]: import http

In [9]: s:'http.server'

In [10]: s
---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-10-ded5ba42480f> in <module>
----> 1 s

NameError: name 's' is not defined

jett chen
  • 1,067
  • 16
  • 33

1 Answers1

0

What you are describing here is called annotations. So in your case log is not a instance of mitmproxy.log.Log. See by yourself:

>>> log.__annotations__
'mitmproxy.log.Log'

If you want to create an instance of the class Class please use this syntax:

s = Class()
eliottness
  • 136
  • 3