Message285647
| Author |
rhettinger |
| Recipients |
larry, meador.inge, methane, ncoghlan, rhettinger, serhiy.storchaka, zach.ware |
| Date |
2017年01月17日.15:03:03 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1484665383.47.0.580618630565.issue20291@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
In case it is helpful, here's my list of examples where the AC and existing signature objects are insufficiently expressive:
type(obj)
type(name, bases, mapping)
two different signatures depending on type
range(stop)
range(start, stop)
range(start, stop, step)
dict.pop(key[, default])
default of None has different meaning than missing default
which raises KeyError when the key is missing
itertools.permutations(iterable[, r])
where the absence of *r* implies r=len(iterable)
bisect.bisect_right(a, x[, lo[, hi]]) -> index
where the absence of *hi* implies hi=len(a)
min(iterable, *[, default=obj, key=func]) -> value
min(arg1, arg2, *args, *[, key=func]) -> value
has two signatures depending on the number of
positional arguments and a keyword argument
only used in the first signature. It's implementation
is also shared with max().
dict() -> new empty dictionary
dict(mapping) -> new dictionary initialized from a mapping object's
(key, value) pairs
dict(iterable) -> new dictionary initialized as if via:
d = {}
for k, v in iterable:
d[k] = v
dict(**kwargs) -> new dictionary initialized with the name=value pairs
in the keyword argument list. For example: dict(one=1, two=2)
def sumseq(seq, a=0, b=None):
# Pure python code with nullable int
if b is None:
b = len(seq)
return sum(seq[a:b]) |
|