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 — Skip the `__bytes__` lookup in bytes() for exact bytes and int · Issue #160931 · python/cpython Open Labels interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement DescriptionFeature or enhancementSince 3.11 added Both types are immutable, so
Subclasses, including That makes Benchmark scriptimport pyperf runner = pyperf.Runner() for stmt in ["bytes(b)", "bytes(16)", "bytes(ba)", "bytes(mv)", "bytes(l)", "bytes(s, 'ascii')", "bytes(hb)", "Sub(b)", "bytes()", "len(l)", "l[0]", "x + 1", "str(x)"]: runner.timeit(stmt, stmt, "b = b'abcdefghijklmnop'; ba = bytearray(b); mv = memoryview(b); " "l = list(range(16)); s = 'abcdefghijklmnop'; x = 12345\n" "class Sub(bytes): pass\n" "class HB:\n def __bytes__(self): return b\n" "hb = HB()") Has this already been discussed elsewhere?This is a minor feature, which does not need previous discussion elsewhere Links to previous discussion of this feature:No response Linked PRsActivity
MetadataMetadataAssigneesLabelsinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — 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. |