Raymond Hettinger added the comment:
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])
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20291>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com