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 — Improve error message from `os.fspath` if `__fspath__` is set to `None` · Issue #106046 · python/cpython Closed Labels type-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementA common Python idiom is to set a magic method to >>> class Foo(list): ... __iter__ = None ... >>> iter(Foo()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'Foo' object is not iterable >>> class Bar(int): ... __hash__ = None ... >>> hash(Bar(42)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'Bar' However, Python doesn't currently do the same thing for >>> from pathlib import Path >>> import os >>> class Baz(Path): ... __fspath__ = None ... >>> os.fspath(Baz()) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: 'NoneType' object is not callable PitchIt would be nice if Python handled Linked PRsActivity
MetadataMetadataAssigneesLabelstype-featureA feature request or enhancementA feature request or enhancement 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. |