compile() question
afabbro
afabbro at indoctrination.com
Fri Dec 14 18:29:07 EST 2001
More information about the Python-list mailing list
Fri Dec 14 18:29:07 EST 2001
- Previous message (by thread): compile() question
- Next message (by thread): compile() question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am parsing a stream of colon-delimited fields (field:value) where the field is an attribute for an object. Since there are a few dozen fields and I don't want to handle each field separately, I used exec to make it easy (after splitting): exec ( 'volume.' + field + ' = "' + value + '"' ) which means the exec'd python code is something like: volume.barcode = 'T00123' So far, so good. Unfortunately, there is a lot of data to process and I'd like to speed it up. I'm thinking that I could possible compile() the command ahead of time? Unfortunately, I can't find a decent example of what I want to do anywhere (-Learning Perl-, the Python docs, etc.) I'm new to Python and am wondering how I can pass variables into a compile() so that everytime I exec it, it does the substitution? Thanks! - andrew fabbro afabbro at indoctrination.com
- Previous message (by thread): compile() question
- Next message (by thread): compile() question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list