GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||
GeezerVison is showing github.com — OrderedDict.fromkeys() returns Dict instead of OrderedDict · Issue #3800 · python/typeshed Closed Description
typeshed/stdlib/2and3/builtins.pyi Lines 999 to 1004 in 9500296
Easy way to fix this is to explicitly override to return I tried to fix it using generic self. For the first (short) form of class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): _FK1 = TypeVar('_FK1', bound='dict[_KT, None]') @classmethod def fromkeys(cls: Type[_FK1], __iterable: Iterable[_T]) -> _FK1: ... This uses the method described in the docs. But the second (long) form has a complication - the value type of the dict depends on a generic argument to class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]): _FK2 = TypeVar('_FK2', bound='dict[_KT, _S]') @classmethod def fromkeys(cls: Type[_FK2], __iterable: Iterable[_T], __value: _S) -> _FK2: ... Understandably fails with I wonder if there is a way to make this work? Reacted by Andrew Activity
MetadataMetadataAssigneesLabelsNo labels ProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |