
On Mon, Dec 30, 2013 at 6:38 AM, anatoly techtonik <techtonik@gmail.com> wrote:
If Python is about readability then looking at your example, I have two questions: 1. What is platform - hardware, CPU, OS, Python flavor? 2. What is uname()[4]?
For os.architecture I have only one question - what is the returned value? And it is easy to remember once you get it. It is also easy to debug.
You can also use platform.uname().machine if you prefer readability, but that doesn't work on Python 2. Number of bits is sufficient only if you can always assume you're on the same architecture. It's much better to simply quote the uname value. And hey, you can even cut your code down from four lines to one: download('http://www.libsdl.org/release/SDL2-2.0.1-win32-'+uname()[4])+'.zip') If you get back a 404, obviously this platform's not supported. Bingo! You've just protected yourself against trying to download and run Intel code on an ARM chip. ChrisA