Message55022
1. If this proposal is accepted, it will make sense to deprecate the use of None as an identity function in map:
>>> map(None, range(10))
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2. Some other languages have an dyadic identity function that returns the *second* argument.
For example, K has : primitive:
identity:(:)
identity[1;2]
2
The rationale in K is that it is useful in an ammed function that replaces entries of an an array with a result of a dyadic function applied to the old and the supplied value and it is natural to have old value first:
@[1 2 3;1;-;20]
1 -18 3
@[1 2 3;1;:;20]
1 20 3
This rationale does not apply to Python, but in the absence of other reasons to choose the order of arguments, Python may as well follow the precedent. Does anyone know a less exotic language that has a dyadic identity?
|
|
Date |
User |
Action |
Args |
2007-08-23 16:12:36 | admin | link | issue1673203 messages |
2007-08-23 16:12:36 | admin | create | |
|