On 09/13/10 02:18, Takeshi Asano wrote:
Hi Sue,
On 2010年09月11日 02:40, Sue Sohn wrote:
:
Regarding isinstance(basestring) inserted in textwidth(),
you found some case that instance of other class or list can be
passed? In that case, raising error (TypeError?) or considering
to enhance the function if expectation of the caller is reasonable.
The text in edit_field is stored as a list, so this check was needed
to avoid throwing an exception.
What the caller expects to get from textwidth() when passing
a list?
- total width when all texts in the list are concatenated
- max width when drawing each text separately
- other?
The first bullet is the expectation. The list in question is a list of
characters, so getting the length of the string (concatenated characters) is the
desired result.
Thanks,
Sue
Basically textwidth() behaves like len() for string objects
except counting columns rather than characters or bytes.
Simply applying this basic will make textwidth() return
number of items for list, but I think it may not meet
the caller's expectation.
Thanks,
Takeshi
_______________________________________________
caiman-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/caiman-discuss