Concatenate two sequences: ``a + b``. Returns: Sequence: The return value will depend on the largest sequence - if b is larger and is a tuple, the return value will be a tuple. - if a is larger and is a list, the return value will be a list,
(a, b)
| 484 | |
| 485 | |
| 486 | def seq_concat_seq(a, b): |
| 487 | """Concatenate two sequences: ``a + b``. |
| 488 | |
| 489 | Returns: |
| 490 | Sequence: The return value will depend on the largest sequence |
| 491 | - if b is larger and is a tuple, the return value will be a tuple. |
| 492 | - if a is larger and is a list, the return value will be a list, |
| 493 | """ |
| 494 | # find the type of the largest sequence |
| 495 | prefer = type(max([a, b], key=len)) |
| 496 | # convert the smallest list to the type of the largest sequence. |
| 497 | if not isinstance(a, prefer): |
| 498 | a = prefer(a) |
| 499 | if not isinstance(b, prefer): |
| 500 | b = prefer(b) |
| 501 | return a + b |
| 502 | |
| 503 | |
| 504 | def is_numeric_value(value): |
no outgoing calls