[英]What does a double underscore mean in a Python import statement?
The documentation for Amazon Neptune contains the following code sample. Amazon Neptune 的文档包含以下代码示例。
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?问题:第 4 行中的双下划线是什么意思?
Since this is being used in an import statement, it must somehow be different than "name mangling" in Python class definitions .由于这是在导入语句中使用的,因此它必须以某种方式不同于Python class 定义中的“名称修改” 。 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.您可以在线找到代码,并在正在导入的 package 中看到具有该名称的 class。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.