MCPcopy Index your code
hub / github.com/webpy/webpy / first

Method first

web/db.py:494–504  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

test_insert_returningMethod · 0.45

Calls 1

nextFunction · 0.85

Tested by 1

test_insert_returningMethod · 0.36