Python Forum

Full Version: seeking names for my functions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am completely refactoring a function i wrote a year or two ago that runs a POSIX command pipeline (commands chained with STDOUT from a command feeding STDIN of the next command). this time i am making three variations, #1 is a generator that yields one line at a time, #2 returns a list of lines for the whole output (after it waits for EOF), #3 just returns the read end of the pipe from STDOUT of the last process. the generator has an option to yield an extra value at the start and another value at the end of the generated sequence of yields. the string type for the lines can be specified like type=str or type=bytes. and type checking is more thorough.

normally a command pipeline is given as a sequence of commands. a command is given as a sequence of strings. but if the 2nd level is all strings giving just one command (not a pipeline) it is wrapped in a tuple to be a "pipeline" of just one command. a single command (a sequence of strings) can be given either way.

any string can by given as type str, or bytes, or bytearray. any sequence can be given as type list or type tuple.

keyword argument stdin= is passed to the first command to give it input. this can be an open file object, or an int, or a string. if it is an int or string, it is opened to be a file object. if stdin=False then the null file is opened. i am thinking about ways to do stdout= which may conflict with the three output variations. that may include a stderr= keyword argument.

what i am seeking is suggestions for names for these functions. i initially coded them with big long names (such as command_pipeline_generator()). are big long names preferred, or shorter names? or maybe extreme short.