4

As shown in image below, what do _S@map and _T@map mean?

enter image description here


Additional information:

Looking at multiprocessing.Pool.map definition there is not type hints, so the types above must be automatically generated by Pylance, which is the language server I was using

    def map(self, func, iterable, chunksize=None):
        '''
        Apply `func` to each element in `iterable`, collecting the results
        in a list that is returned.
        '''
        return self._map_async(func, iterable, mapstar, chunksize).get()
Leonardus Chen
  • 1,103
  • 6
  • 20
  • I don't think that's legal Python. I've never seen anything like that before. – Frank Yellin Feb 25 '22 at 06:28
  • The type hints probably come from [typeshed](https://github.com/python/typeshed/blob/master/stdlib/multiprocessing/pool.pyi#L88), not something generated by Pylance. From context, it *looks* like the `@` shows what function or class introduces a particular type variable, useful for cases where a generic class has generic methods, but I don't know for sure. – user2357112 Feb 25 '22 at 06:28
  • Annotations are a label _"used by convention as a type hint"_. This looks like they have their own system differing from the standard convention. But still "legal Python" IMHO. – VPfB Feb 25 '22 at 07:20
  • Does this answer your question? ["at" sign (@) in Python type hints (suggested by Pylance / Pyright)](https://stackoverflow.com/questions/74111063/at-sign-in-python-type-hints-suggested-by-pylance-pyright) – pigrammer Feb 25 '23 at 18:46

0 Answers0