[Python-checkins] r67357 - in sandbox/trunk/tkinter-polo/src: Tkinter.py _tkinter.c

guilherme.polo python-checkins at python.org
Sun Nov 23 22:35:48 CET 2008


Author: guilherme.polo
Date: Sun Nov 23 22:35:48 2008
New Revision: 67357
Log:
* Documented _flatten in _tkinter.c;
* Removed _flatten implementation from Tkinter since _tkinter must be available
 in order to Tkinter work;
* Removed check for _tkinter._cnfmerge which always fails given current _tkinter
* Removed the methods image_name and image_types from Misc, they are already
 present in Tkinter.py global namespace
Modified:
 sandbox/trunk/tkinter-polo/src/Tkinter.py
 sandbox/trunk/tkinter-polo/src/_tkinter.c
Modified: sandbox/trunk/tkinter-polo/src/Tkinter.py
==============================================================================
--- sandbox/trunk/tkinter-polo/src/Tkinter.py	(original)
+++ sandbox/trunk/tkinter-polo/src/Tkinter.py	Sun Nov 23 22:35:48 2008
@@ -46,18 +46,7 @@
 except AttributeError: _tkinter.deletefilehandler = None
 
 
-def _flatten(nested):
- """Internal function."""
- res = ()
- for item in nested:
- if isinstance(item, (tuple, list)):
- res = res + _flatten(item)
- elif item is not None:
- res = res + (item, )
- return res
-
-try: _flatten = _tkinter._flatten
-except AttributeError: pass
+_flatten = _tkinter._flatten
 
 def _cnfmerge(cnfs):
 """Internal function."""
@@ -76,8 +65,6 @@
 cnf[k] = v
 return cnf
 
-try: _cnfmerge = _tkinter._cnfmerge
-except AttributeError: pass
 
 class Event:
 """Container for the properties of an event.
@@ -1391,16 +1378,6 @@
 return self.tk.splitlist(
 self.tk.call('event', 'info', virtual))
 
- # Image related commands
-
- def image_names(self):
- """Return a list of all existing image names."""
- return self.tk.call('image', 'names')
-
- def image_types(self):
- """Return a list of all available image types (e.g. phote bitmap)."""
- return self.tk.call('image', 'types')
-
 
 class CallWrapper:
 """Internal class. Stores function to call when some user
Modified: sandbox/trunk/tkinter-polo/src/_tkinter.c
==============================================================================
--- sandbox/trunk/tkinter-polo/src/_tkinter.c	(original)
+++ sandbox/trunk/tkinter-polo/src/_tkinter.c	Sun Nov 23 22:35:48 2008
@@ -2921,6 +2921,10 @@
 	return context.tuple;
 }
 
+PyDoc_STRVAR(_flatten_doc, "_flatten(nested) -> flattened tuple\n\n"
+"Flatten a nest of tuples and lists.");
+
+
 static PyObject *
 Tkinter_Create(PyObject *self, PyObject *args)
 {
@@ -2989,7 +2993,7 @@
 
 static PyMethodDef moduleMethods[] =
 {
-	{"_flatten", Tkinter_Flatten, METH_VARARGS},
+	{"_flatten", Tkinter_Flatten, METH_VARARGS, _flatten_doc},
 	{"create", Tkinter_Create, METH_VARARGS},
 	{"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
 	{"quit", Tkapp_Quit, METH_VARARGS},


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /