Solving real-world problems with existing solutions
With so many great presentations at Ozri it’s hard to choose which one to go to. In case you missed our session, here are the key messages.
Python is a “batteries included” language. The Python Standard Library (which you get when installing Python) has nearly 300 packages which help you get the job done. The modules vary in functionality, ranging from running code in parallel with the multiprocessing library to making your terminal beep with winsound.
There is already a library for this. Before starting a new Python project have a browse of the Python Package Index repository PyPi. The Python community has contributed nearly 50,000 packages that solve real-world problems. Perhaps you’ll find what you were about to write and save yourself weeks, or perhaps you won’t, in which case consider this the perfect opportunity to contribute back to the community.
Read, learn, tinker. To write great scripts it’s not enough to know the Python syntax – you have to know what libraries are available to you. Also, it is not enough to simply copy and paste code and hope that it all works. Reading other people’s libraries will not only help you understand why your script doesn’t work, but it will also teach you good Python idioms and how to structure your code.
The best way to explore the code is to import the library into your Python interpreter and have a play with it – use the dir and help commands to look at what the module offers, then read the source code (hint: you can use the inspect module).
The highlight of our presentation was Todd demonstrating how to put some key libraries to work. With just a few lines of code he brought ArcGIS for Server into the world of DevOps: automation, monitoring and reporting.
Slides and source code can be found using this link.
Todd J & Stoyan S