BMI Students

Tuesday, February 15, 2005

Python stuff

In Python, it's really easy to keep a bunch of variables together. I've started using this a lot recently. Just make a dummy class like so...
class container:
pass
Then you can fill an instance of it with any data you want to keep together. For instance...
my_gene = container()
my_gene.length = 100
my_gene.name = "Something"
dir(my_gene) #to see what is in there
You can use the same dummy container for any collection of data, if you are not too worried about formalising its contents.

0 Comments:

Post a Comment

<< Home