简体   繁体   中英

What does a double underscore mean in a Python import statement?

The documentation for Amazon Neptune contains the following code sample.

from __future__  import print_function  # Python 2/3 compatibility

from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

graph = Graph()

remoteConn = DriverRemoteConnection('wss://your-neptune-endpoint:8182/gremlin','g')
g = graph.traversal().withRemote(remoteConn)

print(g.V().limit(2).toList())
remoteConn.close()

Question : What does the double underscore mean in line number 4?

Since this is being used in an import statement, it must somehow be different than "name mangling" in Python class definitions . I'm just not clear on what it's intended to do.

It's nothing special. You can find the code online and see there is a class with that name in the package that is being imported.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM