4 ms·
Python is platform specific.
by barkingcat 8y ago
Python is platform specific.
- saagarjha 8y ago…no?
- chrisseaton 8y agoYou can write platform specific code in Python. You can get the current operating system and you can write an if statement comparing against operating systems you want to write specific code for.
- saagarjha 8y ago> You can write platform specific code in Python. It's clearly not designed for doing anything advanced, though: it's not like you can get access to platform-specific APIs outside of the basics without doing a lot of work.
- DrJosiah 8y agoctypes is a thing, and gives you access to the world of runtime-loadable libraries on your platform. Beyond that, C modules for Python by hand, SWIG, Cython (can take Python 3.x annotations now), etc., are not bad at all. Can you explain how platform-specific stuff takes "a lot of work" with Python, and wouldn't with some other language that is not Python?
- saagarjha 8y ago> Can you explain how platform-specific stuff takes "a lot of work" with Python, and wouldn't with some other language that is not Python? Sure, just look at a modern Cocoa app written in Swift, or Android one in Java, and compare it to the amount of work you'd have to do to shoehorn Python in there.
- viraptor 8y agoLike this? https://pybee.org/project/using/ios-app/ https://pybee.org/project/using/ios-app/ https://pybee.org/project/using/android-app/ https://pybee.org/project/using/android-app/
- DrJosiah 8y agoviraptor makes a very compelling case for at least 1 option for mobile apps in Python. About 15.5 years ago while I was still a grad student, I released a (horribly designed, mostly self-experimentation) editor in Python + wxPython that I initially wrote to run on Windows. I didn't run it regularly in Linux or OS X until 2008, and it all just worked. OS X was a little laggy with my editor, but hey, write once run on 3 platforms. Python is really solid on multi-platform, because there are so many Python users already using every platform that want to bring Python there.
- sametmax 8y agoQuite the contrary, it is easy to call system api from python. That's why we have so many python wripmers for c code. You have the stdlib ctypes of course, but also pypy's cffi for an even better story. We even have specialized ready to use tools for those, such as pywin32 to manipulate the windows api and registry, pyqt to leverage the c++ qt lib and all it's tooling, or watchdog to survey file changes, using the native api when possible. In fact, mac and linuxes implement natively of lot of tools in their os for this reason. There is also a reason it's one of the few languages allowed in prod at google. It's the best at nothing, but it's damn good at most things.
- saagarjha 8y ago> You have the stdlib ctypes of course, but also pypy's cffi for an even better story. Not something I would call seamless. > pyqt to leverage the c++ qt lib and all it's tooling This isn't native. > mac and linuxes implement natively of lot of tools in their os for this reason Generally command line scripts, which is something that Python is good at. > There is also a reason it's one of the few languages allowed in prod at google. What Google allows in production has only an oblique relevance to whether it should be used for a specific task.