[Mobile-sig] Pythonic idioms on mobile platforms
russell at keith-magee.com
Wed Dec 13 18:40:18 EST 2017
Can’t say I’ve hand any problems on iOS. Under the hood, iOS exposes a POSIX API (with some notable ommissions), so Python threads pretty much work out of the box. The CPython test suite runs fine.
As for Android - that will depend very much on the approach you’re taking. At the raw C API level, I would suspect (but can’t confirm) that Python’s API maps fairly well, for the same reason iOS does. However, that doesn’t help you at the GUI layer, because everything there is in Java. However, the API exposed by Java Runnables maps reasonably well onto what POSIX threads try to do, so I’d be surprised if it couldn’t be converted.
Do you have a specific problem that you’ve encountered that has lead to this question?
Russ Magee %-)
> On 14 Dec 2017, at 12:03 am, David Boddie <david at boddie.org.uk> wrote:
> I was looking at threading on Android and it occurred to me that perhaps
> others sidestep problems I encountered with native APIs by using Python's own
> threading features. Then I wondered if some developers prefer to stick to the
> platform native APIs for things like threading, and if they found it
> difficult to adapt to a non-Pythonic API.
> Has anyone else looked at how well (or poorly) some of the idioms used in
> Python map to each of the underlying mobile platforms and frameworks, or are
> people just using the native APIs directly? The answer to this might save
> someone the effort of trying to reproduce the APIs of those standard Python
> libraries that aren't interesting to mobile developers.
> Mobile-sig mailing list
> Mobile-sig at python.org
More information about the Mobile-sig