classes for fun and newbies

Gustavo Niemeyer niemeyer at conectiva.com
Wed Mar 20 07:10:22 EST 2002


Bruce,

> class call_record:
>     def __init__(self, record=''):
>         self.record_id=record[0:5]
>         self.date=record[6:11]
[...]
> print call_record.record_id(log[1])

Isn't it call_record(log[1]).record_id? If you're going to access
many fields, you should probably save this instance in a temp variable
(e.g. rec = call_record(log[1])) to avoid parsing it every time.

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]




More information about the Python-list mailing list