A One-Pass Hash Table Solution to twoSum
Don't leave white space at the end of lines.
Use enumerate.
When comparing with None use is and is not.
It'd be cleaner to just use in rather than get.
If you want to use nums_d.get then you should use it outside the if so you don't have to use it a second time when you enter the if.
This however makes the code messy for not much of a benefit IMO.
Unless the site forces you to return lists returning a tuple would be more Pythonic.
Your comments aren't helpful, if anything they make the code harder to read for me.
The variable name nums is easier to read then nums_d, the _d is useless.
When returning it would be better to either:


Raise an exception, as the lookup failed.
Return a tuple where both values are None. This is so you can tuple unpack without errors.



Getting the code:

def test_peil(nums: List[int], target: int) -&gt; Tuple[int, ...]:
    lookup = {}
    for i, v in enumerate(nums):
        if target - v in lookup:
            return i, lookup[target - v]
        lookup[v] = i
    raise ValueError('Two sums target not in list.')


You can further improve performance by including Alain T.'s change for small numbers.

def test_peil_alain(nums: List[int], target: int) -&gt; Tuple[int, ...]:
    if len(nums) &lt;= 100:
        for i, n in enumerate(nums):
            if target - n in nums:
                return i, nums.index(target - n)
    else:
        lookup = {}
        for i, v in enumerate(nums):
            if target - v in lookup:
                return i, lookup[target - v]
            lookup[v] = i
    raise ValueError('Two sums target not in list.')


And has a performance improvement: (the graph is volatile due to only using one input sample)