I have a Position
class, and it has two attributes, Lat
and Lon
.
I would like the following API by implementing iterator
protocol (but some googling just confused me more):
pos = Position(30, 50)
print pos.Latitude
> 30
print pos.Longitude
> 50
for coord in pos:
print coord
> 30
> 50
print list(pos)
> [30, 50]