how to pass a custom object to re.search?

brunovianarezende at gmail.com brunovianarezende at gmail.com
Fri Aug 17 16:21:52 CEST 2007


> Try to implement __str__() for your object and provide a string
> representation for it.
>
> re.search(str(custom_object))
>

I've done that (and added __unicode__ too). I only didn't want to, I
want to do:

re.search(custom_object)

so, code that worked before as:

re.search(parentobj.custom_object)

don't have to be changed for:

re.search(str(parentobj.custom_object))

and I'm also curious to know if it is possible to do that... :-)




More information about the Python-list mailing list