# What is the most efficient way to get the values of a previous row in a table using ArcPy?

I am very new to ArcGis and I would like to get a specific value of the previous row in a table.

I found this question here on gis.stackexchange.com and experimented a little bit. However, I found out this modified version:

Pre-Logic Script Code:

import arcpy def getLastASTDate(tableName): return [r[0] for r in arcpy.da.SearchCursor(tableName, "date")][-1]

test =

getLastASTDate("name_of_table")

Unfortunately this version doesn't work and is -- in my opinion -- very inefficient. Do you know any better solutions?