Results tagged “python” from O'Reilly Broadcast

Most Python programs end up as a combination of several modules with a main application importing them. Whether you are using the features of the standard library, or organizing your own code in separate files to make it easier to maintain, understanding and managing the dependencies for your program is an important aspect of development. sys includes information about the modules available to your application, either as built-ins or after being imported. It also defines hooks for overriding the standard import behavior for special cases.
sys includes low-level functions for controlling and debugging thread behavior.
There are two ways to inject code to watch your Python program run: tracing and profiling. They are similar, but intended for different purposes and so have different constraints. The easiest, but least efficient, way to monitor your program is through a trace hook, which can be used for writing a debugger, code coverage monitoring, or many other purposes.
We're launching the beta of O'Reilly Answers, and I'm inviting you to be part of it. In brief, O'Reilly Answers is a community site for sharing knowledge, asking questions, and providing answers that brings together our customers, authors, editors, conference speakers, and Foo (Friends of O'Reilly). O'Reilly is at the center of an amazing exchange of knowledge sharing and idea generation, and we want you to join us in changing the world by spreading the knowledge of innovators.
sys includes features for trapping and working with exceptions.
Python's sys module includes several functions for understanding and controlling memory usage.
sys provides low-level APIs for interacting with the system outside of your application, by accepting command line arguments, accessing user input, and passing messages and status values to the user.
sys contains attributes and functions for accessing compile-time or runtime configuration settings for the interpreter.
The functions in Python's resource module help you probe the current resources consumed by a process, and place limits on them to control how much load your program places on a system.
Python's Fraction class implements numerical operations for rational numbers.
The decimal module implements fixed and floating point arithmetic using the model familiar to most people, rather than the floating point representation implemented by most computer hardware.
The dis module converts code objects to a human-readable representation of the bytecodes for analysis.
The pydoc module imports a Python module and uses the contents to generate help text at runtime.
Python includes several standard programming data structures as built-in types (list, tuple, dictionary, and set). Most applications won't need any other structures, but when they do the standard library delivers.
Basic product attribute questions (what's the best price, size, length, etc) are crucial elements in any product or marketing strategy, but it's often too difficult or expensive to get timely market information. However, a quick script that pulls data from a relevant website's API can often give you an answer that's good enough. This post provides a few techniques for using this powerful new resource for market research.
Python's standard library includes a variety of tools for working with text data.
The urllib2 module provides an updated API for using internet resources identified by URLs. It is designed to be extended by individual applications to support new protocols or add variations to existing protocols (such as handling HTTP basic authentication).
Define and use abstract base classes for API checks in your code using the abc module.
pyclbr can scan Python source to find classes and stand-alone functions. The information about class, method, and function names and line numbers is gathered using tokenize without importing the code.
robotparser implements a parser for the robots.txt file format, including a simple function for checking if a given user agent can access a resource. It is intended for use in well-behaved spiders or other crawler applications that need to either be throttled or otherwise restricted.

Popular Topics

Browse Books

News Topics


Got a Question?