[liblouis-liblouisxml] Re: Patch for allowing python apps to get returned typeform data

  • From: James Teh <jamie@xxxxxxxxxxx>
  • To: liblouis-liblouisxml@xxxxxxxxxxxxx
  • Date: Tue, 09 Feb 2010 09:05:00 +1000

On 9/02/2010 8:29 AM, Michael Whapples wrote:
Note that this will not work if typeform is given as a
tuple
I had just assumed it would always be a list as that is what the
docstring says
A fair enough assumption. Normally, it makes sense to allow an incoming sequence to be any kind of sequence, but the docstring says list, so it's fair to assume that old code will use a list.

probably why I like java as this issue would not arise.
Dynamic typing can be both a blessing and a curse. :)

I really don't know if backwards compatibility is an
issue, how many really currently use typeform?
I suspect no one excewpt Christian, as the recent crash bug would have caused problems for almost anyone who tried it and we would have heard about it. :) NVDA certainly doesn't use it. I just checked and Orca doesn't use it either.

+ # Now prepare typeform list for calling app
If I'm not mistaken, this entire last chunk of code (after the
comment) can be replaced with one call:
typeform[:] = typeformbuf.value
I was just thinking explicit steps.
True, but why not let Python do the work for us? :)
However thinking more, your line
might not work as you might hope as it might just end up as a list with
one string value (I don't actually know, just me thinking).
It won't. Python will treat the string as a sequence (as opposed to a single element) because you're assigning it to a sequence:
>>> l = []; l[:] = 'abc'; l
['a', 'b', 'c']

Jamie

--
James Teh
Email/MSN Messenger/Jabber: jamie@xxxxxxxxxxx
Web site: http://www.jantrid.net/
For a description of the software and to download it go to
http://www.jjb-software.com

Other related posts: