[Tutor] Instantiating a list of strings into a list of classes
vandyke.geospatial at gmail.com
Sat Mar 6 02:38:08 CET 2010
I cut my teeth of Fortran95, and in the distant past rode the turtle, and
while I enjoy the mind-bendy feeling of shifting my programming paradigm
(and LOVE LOVE LOVE Python), I get sheepish when I feel I'm missing
I have a csv list of data, of the form:
plot, utmN83_X, utmN83_Y, plot_radius_m
I built a nifty ClassGPSPoint(Xpos,Ypos,plotRadius,workPaths) that eats the
X&Y positions, the plot radius, and previously instantiated object holding
all of the appropriate paths definitions to access the LiDAR LAS files.
I make a nice CSV reader with one line (did I mention I LOVE python?)...
What I want to do is use the first entry in that row (row) as the
variable name for the instantiated class. I'd get an instantiated GPSPoint
object called 'Spring1' that would yield all my methods and defined values
(Spring1.pathLASfile, Spring1.perturbXY(), etc)....
Hence, in pseudocode:
for row in plotReader:
row = GPSPoint(row,row,18.3,workPaths)
But that doesn't work. I'm probably missing something basic and profound,
(I was trying to use global to track my paths until I got my mind around the
passing the instantiated object thing, but whaddya gonna do? Sequential to
OO is a big shift, you know?)
Thanks ya'll -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor