简体   繁体   中英

Difference between multiprocessing.Pipe and multiprocessing.connection.Pipe

I've found that python.org has official documentation for multiprocessing.Pipe , but my PyCharm IDE suggests me to import multiprocessing.connection.Pipe , which has no documentation. Built-in help system says as follows:

>>> from multiprocessing import Pipe as P1
>>> from multiprocessing.connection import Pipe as P2    
>>> help(P1)
Help on method Pipe in module multiprocessing.context:

Pipe(duplex=True) method of multiprocessing.context.DefaultContext instance
    Returns two connection object connected by a pipe

>>> help(P2)
Help on function Pipe in module multiprocessing.connection:

Pipe(duplex=True)
    Returns pair of connection objects at either end of a pipe

So what's the difference, where the docs and which one should I use?

I've figured out it's actually the same thing. In file multiprocessing/context.py I've found the following lines:

def Pipe(self, duplex=True):
    '''Returns two connection object connected by a pipe'''
    from .connection import Pipe
    return Pipe(duplex)

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