Package twisted :: Package python :: Module util
[show private | hide private]
[frames | no frames]

Module twisted.python.util

Function Summary
  addPluginDir()
  dict(*a, **k)
  getPassword(prompt, confirm)
Obtain a password by prompting or from stdin.
  getPluginDirs()
  padTo(n, seq, default)
Pads a sequence out to n elements,
  println(*a)
  sibpath(path, sibling)
Return the path to a sibling of a file in the filesystem.
  uniquify(lst)
Make the elements of a list unique by inserting them into a dictionary.

Function Details

getPassword(prompt='Password: ', confirm=0)

Obtain a password by prompting or from stdin.

If stdin is a terminal, prompt for a new password, and confirm (if confirm is true) by asking again to make sure the user typed the same thing, as keystrokes will not be echoed.

If stdin is not a terminal, read in a line and use it as the password, less the trailing newline, if any.
Returns:
str

padTo(n, seq, default=None)

Pads a sequence out to n elements,

filling in with a default value if it is not long enough.

If the input sequence is longer than n, raises ValueError.

Details, details: This returns a new list; it does not extend the original sequence. The new list contains the values of the original sequence, not copies.

sibpath(path, sibling)

Return the path to a sibling of a file in the filesystem.

This is useful in conjunction with the special __file__ attribute that Python provides for modules, so modules can load associated resource files.

uniquify(lst)

Make the elements of a list unique by inserting them into a dictionary.

Generated by Epydoc 1.2 prerelease on Wed Jan 29 06:28:38 2003 http://epydoc.sf.net