how to pass a custom object to re.search?

brunovianarezende at gmail.com brunovianarezende at gmail.com
Fri Aug 17 10:02:27 EDT 2007


Hi,

sorry if this is a faq. I've searched and got no result. I'm willing
to pass a custom object to re.search method, but I'm getting the
error:

TypeError: expected string or buffer

I don't want to make my object to inherit from basestring (nor I know
how to do it...). Then I was left with 'buffer'. I tried to make my
object inherit from types.BufferType and got the error:

TypeError: Error when calling the metaclass bases
    type 'buffer' is not an acceptable base type

If I call the function buffer passing an instance of my object I get:

TypeError: buffer object expected

Is it possible to make what I want (to pass a custom object to
re.search)?

regards,
Bruno




More information about the Python-list mailing list