IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
17.6.1 asynchat - Auxiliary Classes and Functions

17.6.1 asynchat - Auxiliary Classes and Functions

class simple_producer( data[, buffer_size=512])
A simple_producer takes a chunk of data and an optional buffer size. Repeated calls to its more() method yield successive chunks of the data no larger than buffer_size.

more( )
Produces the next chunk of information from the producer, or returns the empty string.

class fifo( [list=None])
Each channel maintains a fifo holding data which has been pushed by the application but not yet popped for writing to the channel. A fifo is a list used to hold data and/or producers until they are required. If the list argument is provided then it should contain producers or data items to be written to the channel.

is_empty( )
Returns True iff the fifo is empty.

first( )
Returns the least-recently push()ed item from the fifo.

push( data)
Adds the given data (which may be a string or a producer object) to the producer fifo.

pop( )
If the fifo is not empty, returns True, first(), deleting the popped item. Returns False, None for an empty fifo.

The asynchat module also defines one utility function, which may be of use in network and textual analysis operations.

find_prefix_at_end( haystack, needle)
Returns True if string haystack ends with any non-empty prefix of string needle.

See About this document... for information on suggesting changes.