Returns the first row of this ResultSet or None when there are no elements. If the optional argument default is specified, that is returned instead of None when there are no elements.
(self, default=None)
| 492 | next = __next__ # for python 2.7 support |
| 493 | |
| 494 | def first(self, default=None): |
| 495 | """Returns the first row of this ResultSet or None when there are no |
| 496 | elements. |
| 497 | |
| 498 | If the optional argument default is specified, that is returned instead |
| 499 | of None when there are no elements. |
| 500 | """ |
| 501 | try: |
| 502 | return next(iter(self)) |
| 503 | except StopIteration: |
| 504 | return default |
| 505 | |
| 506 | def __getitem__(self, i): |
| 507 | # todo: slices |