From: Nicolas G. <nic...@ga...> - 2006-11-09 01:30:46
|
Thank you John for your answer. You're right: efficiency is a non-issue. I shouldn't have mentioned it. On 11/5/06, John Hunter <jdh...@ac...> wrote: > Nicolas> But in this function, I don't like the idea to try an > Nicolas> operation on a string, and wait for an exception in order > Nicolas> to know if we really have a string or not. It's not very > Nicolas> efficient, nor very beautiful. > > Nicolas> I guess initial developer did that to keep compatibility > Nicolas> with old Python versions. > > I did it because it is general, elegant, and efficiency doesn't matter > here (any string operation is insignificant to the work we do making a > figure). What if a user writes their own string class, eg someone > wants a mutable string, or a lower case string, or any number of > custom string objects, and these aren't covered by the types module? > > We make heavy use of duck typing in matplotlib, and it hasn't caused > us any problems I know of. > > JDH |