Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc3952d4

Browse files
authored
Update mymax.py
1 parent746ab74 commitc3952d4

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

‎less_than/max_overload/mymax.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# tag::MYMAX_TYPES[]
22
fromtypingimportProtocol,Any,TypeVar,overload,Callable,Iterable,Union
33

4+
MISSING=object()
5+
EMPTY_MSG='max() arg is an empty sequence'
6+
47
class_SupportsLessThan(Protocol):
58
def__lt__(self,other:Any)->bool: ...
69

710
_T=TypeVar('_T')
811
_LT=TypeVar('_LT',bound=_SupportsLessThan)
912
_DT=TypeVar('_DT')
1013

11-
MISSING=object()
12-
EMPTY_MSG='max() arg is an empty sequence'
13-
1414
@overload
1515
defmax(__arg1:_LT,__arg2:_LT,*_args:_LT,key:None= ...)->_LT:
1616
...
@@ -29,8 +29,6 @@ def max(__iterable: Iterable[_LT], *, key: None = ..., default: _DT) -> Union[_L
2929
@overload
3030
defmax(__iterable:Iterable[_T],*,key:Callable[[_T],_LT],default:_DT)->Union[_T,_DT]:
3131
...
32-
# end::MYMAX_TYPES[]
33-
# tag::MYMAX[]
3432
defmax(first,*args,key=None,default=MISSING):
3533
ifargs:
3634
series=args
@@ -55,7 +53,6 @@ def max(first, *args, key=None, default=MISSING):
5553
candidate=current
5654
candidate_key=current_key
5755
returncandidate
58-
# end::MYMAX[]
5956

6057
@overload
6158
defmin(__arg1:_LT,__arg2:_LT,*_args:_LT,key:None= ...)->_LT:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp