Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #197212

bool type have big problem. finally program returned "True".Is this the TRUE spec?

From あうぇくろ <deqser25@gmail.com>
Newsgroups comp.lang.python
Subject bool type have big problem. finally program returned "True".Is this the TRUE spec?
Date 2025-01-18 21:55 +0900
Message-ID <mailman.92.1737391296.2912.python-list@python.org> (permalink)
References <CAAoNPLevMbMzeuCRKDqY2n6Wg2=fkSUohHEGAhN0tS83hne07Q@mail.gmail.com>

Show all headers | View raw


from typing import List
from types import FunctionType, LambdaType


def composite(*func: List[FunctionType]) -> LambdaType:
if len(func) < 2:
raise TypeError(f'composite expected over 2 arguments, but got {len(func)}')
if len(func) == 2:
return lambda *args, **kwargs: func[1](func[0](*args, **kwargs))

return lambda *args, **kwargs: composite(*func[1:])(func[0](*args, **kwargs
))
tpr=composite(type,print)
print(tpr('a')==tpr(1))

I subscribed to python-list, so I sent this message again.
Why does tpr('a')==tpr(1) return True?

Back to comp.lang.python | Previous | NextNext in thread | Find similar


Thread

bool type have big problem. finally program returned "True".Is this the TRUE spec? あうぇくろ <deqser25@gmail.com> - 2025-01-18 21:55 +0900
  Re: bool type have big problem. finally program returned "True".Is this the TRUE spec? Alan Bawden <alan@csail.mit.edu> - 2025-01-20 14:16 -0500

csiph-web