Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/file/7de42d758354/allpy/util.py
Дата изменения: Unknown
Дата индексирования: Sun Feb 3 20:41:54 2013
Кодировка:
allpy: 7de42d758354 allpy/util.py

allpy

view allpy/util.py @ 836:7de42d758354

Added deprecation warnings to the deprecated functions.
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Tue, 19 Jul 2011 14:40:22 +0400
parents 4bc2075d338a
children 8b25fa9734c0
line source
1 """Miscellanous utilities.
2 """
3 import warnings
5 def unzip(seq):
6 """The oppozite of zip() builtin."""
7 a, b = [], []
8 for x, y in seq:
9 a.append(x)
10 b.append(y)
11 return a, b
13 def remove_each(string, substrings):
14 """Remove each of substrings from string."""
15 for sub in substrings:
16 string = string.replace(sub, "")
17 return string
19 class UserDict(dict):
20 """Clone of dict that user may add attributes to."""
21 pass
23 class UserList(list):
24 """Clone of list that user may add attributes to."""
25 pass
27 class UserString(str):
28 """Clone of str that user may add attributes to."""
29 pass
31 def deprecated(message):
32 """Warn about function being deprecated."""
33 warnings.warn(message, DeprecationWarning, stacklevel=2)
35 # vim: set et ts=4 sts=4 sw=4: