dfernan
asked on
access an attribute of a class from a list
I have the following class.
class chrom(object):
"""docstring for chrom"""
def __init__(self, chr, position, ma2c):
self.chr = chr
self.position = position
self.ma2c = ma2c
and then i have a list of this chrom objects called chromlist.
Let us imagine I want to create a sublist with the position of the items i to j from the chromlist!!!!
How would i do that in the esiest and most efficient way. I can' t do chromsublist[0:4].position ???? why?
class chrom(object):
"""docstring for chrom"""
def __init__(self, chr, position, ma2c):
self.chr = chr
self.position = position
self.ma2c = ma2c
and then i have a list of this chrom objects called chromlist.
Let us imagine I want to create a sublist with the position of the items i to j from the chromlist!!!!
How would i do that in the esiest and most efficient way. I can' t do chromsublist[0:4].position
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.