<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
We have abstract base classes for such tests, but there's nothing<br>
which would define "string-like" as ABC. Before trying to define<br>
a test via a special method, I think it's better to define what<br>
exactly you mean by "string-like".<br>
<br>
Something along the lines of numbers.Number, but for strings.<br>
<br>
To make an object string-like, you then test for the ABC and<br>
then call .__str__() to get the string representation as string.<br>
<span class="im HOEnZb"><br></span></blockquote><div><br></div><div>Does ABC is easy to use from C?</div><div>There should be easy way to (1) define "string-like" class in C and (2) use "string-like" object from C.</div><div><br></div></div>
</div></div>