[Python-checkins] r43101 - in python/branches/p3yk: Demo/classes/bitvec.py Demo/metaclasses/Eiffel.py Demo/metaclasses/Meta.py Demo/metaclasses/Simple.py Demo/metaclasses/Synch.py Demo/metaclasses/Trace.py Demo/pdist/RCSProxy.py Demo/pdist/client.py Demo/pdist/server.py Demo/threads/Coroutine.py Demo/threads/Generator.py Demo/threads/find.py Demo/tix/tixwidgets.py Demo/tkinter/guido/AttrDialog.py Demo/tkinter/guido/ManPage.py Demo/tkinter/guido/ShellWindow.py Demo/tkinter/guido/kill.py Demo/tkinter/guido/optionmenu.py Demo/tkinter/guido/sortvisu.py Demo/tkinter/guido/svkill.py Demo/tkinter/matt/window-creation-w-location.py Doc/api/abstract.tex Doc/lib/libfuncs.tex Lib/bsddb/dbobj.py Lib/bsddb/dbshelve.py Lib/bsddb/test/test_basics.py Lib/bsddb/test/test_dbobj.py Lib/bsddb/test/test_join.py Lib/compiler/transformer.py Lib/distutils/archive_util.py Lib/distutils/command/build_ext.py Lib/distutils/command/build_py.py Lib/distutils/dir_util.py Lib/distutils/filelist.py Lib/distutils/util.py Lib/idlelib/MultiCall.py Lib/logging/__init__.py Lib/logging/config.py Lib/plat-mac/gensuitemodule.py Lib/subprocess.py Lib/test/crashers/infinite_rec_4.py Lib/test/test_builtin.py Mac/Demo/sound/morse.py Mac/Tools/IDE/ProfileBrowser.py Mac/Tools/IDE/PyConsole.py Mac/Tools/IDE/PyDebugger.py Mac/Tools/IDE/Wapplication.py Mac/Tools/IDE/Wbase.py Mac/Tools/macfreeze/macgen_bin.py Mac/scripts/buildpkg.py PCbuild/readme.txt Python/bltinmodule.c Tools/freeze/freeze.py Tools/pynche/pyColorChooser.py Tools/unicode/gencodec.py Tools/webchecker/webchecker.py

neal.norwitz python-checkins at python.org
Fri Mar 17 09:00:38 CET 2006


Author: neal.norwitz
Date: Fri Mar 17 09:00:19 2006
New Revision: 43101
Removed:
 python/branches/p3yk/Lib/test/crashers/infinite_rec_4.py
Modified:
 python/branches/p3yk/Demo/classes/bitvec.py
 python/branches/p3yk/Demo/metaclasses/Eiffel.py
 python/branches/p3yk/Demo/metaclasses/Meta.py
 python/branches/p3yk/Demo/metaclasses/Simple.py
 python/branches/p3yk/Demo/metaclasses/Synch.py
 python/branches/p3yk/Demo/metaclasses/Trace.py
 python/branches/p3yk/Demo/pdist/RCSProxy.py
 python/branches/p3yk/Demo/pdist/client.py
 python/branches/p3yk/Demo/pdist/server.py
 python/branches/p3yk/Demo/threads/Coroutine.py
 python/branches/p3yk/Demo/threads/Generator.py
 python/branches/p3yk/Demo/threads/find.py
 python/branches/p3yk/Demo/tix/tixwidgets.py
 python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py
 python/branches/p3yk/Demo/tkinter/guido/ManPage.py
 python/branches/p3yk/Demo/tkinter/guido/ShellWindow.py
 python/branches/p3yk/Demo/tkinter/guido/kill.py
 python/branches/p3yk/Demo/tkinter/guido/optionmenu.py
 python/branches/p3yk/Demo/tkinter/guido/sortvisu.py
 python/branches/p3yk/Demo/tkinter/guido/svkill.py
 python/branches/p3yk/Demo/tkinter/matt/window-creation-w-location.py
 python/branches/p3yk/Doc/api/abstract.tex
 python/branches/p3yk/Doc/lib/libfuncs.tex
 python/branches/p3yk/Lib/bsddb/dbobj.py
 python/branches/p3yk/Lib/bsddb/dbshelve.py
 python/branches/p3yk/Lib/bsddb/test/test_basics.py
 python/branches/p3yk/Lib/bsddb/test/test_dbobj.py
 python/branches/p3yk/Lib/bsddb/test/test_join.py
 python/branches/p3yk/Lib/compiler/transformer.py
 python/branches/p3yk/Lib/distutils/archive_util.py
 python/branches/p3yk/Lib/distutils/command/build_ext.py
 python/branches/p3yk/Lib/distutils/command/build_py.py
 python/branches/p3yk/Lib/distutils/dir_util.py
 python/branches/p3yk/Lib/distutils/filelist.py
 python/branches/p3yk/Lib/distutils/util.py
 python/branches/p3yk/Lib/idlelib/MultiCall.py
 python/branches/p3yk/Lib/logging/__init__.py
 python/branches/p3yk/Lib/logging/config.py
 python/branches/p3yk/Lib/plat-mac/gensuitemodule.py
 python/branches/p3yk/Lib/subprocess.py
 python/branches/p3yk/Lib/test/test_builtin.py
 python/branches/p3yk/Mac/Demo/sound/morse.py
 python/branches/p3yk/Mac/Tools/IDE/ProfileBrowser.py
 python/branches/p3yk/Mac/Tools/IDE/PyConsole.py
 python/branches/p3yk/Mac/Tools/IDE/PyDebugger.py
 python/branches/p3yk/Mac/Tools/IDE/Wapplication.py
 python/branches/p3yk/Mac/Tools/IDE/Wbase.py
 python/branches/p3yk/Mac/Tools/macfreeze/macgen_bin.py
 python/branches/p3yk/Mac/scripts/buildpkg.py
 python/branches/p3yk/PCbuild/readme.txt
 python/branches/p3yk/Python/bltinmodule.c
 python/branches/p3yk/Tools/freeze/freeze.py
 python/branches/p3yk/Tools/pynche/pyColorChooser.py
 python/branches/p3yk/Tools/unicode/gencodec.py
 python/branches/p3yk/Tools/webchecker/webchecker.py
Log:
Remove apply()
Modified: python/branches/p3yk/Demo/classes/bitvec.py
==============================================================================
--- python/branches/p3yk/Demo/classes/bitvec.py	(original)
+++ python/branches/p3yk/Demo/classes/bitvec.py	Fri Mar 17 09:00:19 2006
@@ -172,7 +172,7 @@
 def __cmp__(self, other, *rest):
 #rprt('%r.__cmp__%r\n' % (self, (other,) + rest))
 if type(other) != type(self):
- other = apply(bitvec, (other, ) + rest)
+ other = bitvec(other, *rest)
 #expensive solution... recursive binary, with slicing
 length = self._len
 if length == 0 or other._len == 0:
@@ -237,7 +237,7 @@
 #rprt('%s.__setslice__%r\n' % (self, (i, j, sequence) + rest))
 i, j = _check_slice(self._len, i, j)
 if type(sequence) != type(self):
- sequence = apply(bitvec, (sequence, ) + rest)
+ sequence = bitvec(sequence, *rest)
 #sequence is now of our own type
 ls_part = self[:i]
 ms_part = self[j:]
@@ -283,7 +283,7 @@
 def __and__(self, otherseq, *rest):
 #rprt('%r.__and__%r\n' % (self, (otherseq,) + rest))
 if type(otherseq) != type(self):
- otherseq = apply(bitvec, (otherseq, ) + rest)
+ otherseq = bitvec(otherseq, *rest)
 #sequence is now of our own type
 return BitVec(self._data & otherseq._data, \
 min(self._len, otherseq._len))
@@ -292,7 +292,7 @@
 def __xor__(self, otherseq, *rest):
 #rprt('%r.__xor__%r\n' % (self, (otherseq,) + rest))
 if type(otherseq) != type(self):
- otherseq = apply(bitvec, (otherseq, ) + rest)
+ otherseq = bitvec(otherseq, *rest)
 #sequence is now of our own type
 return BitVec(self._data ^ otherseq._data, \
 max(self._len, otherseq._len))
@@ -301,7 +301,7 @@
 def __or__(self, otherseq, *rest):
 #rprt('%r.__or__%r\n' % (self, (otherseq,) + rest))
 if type(otherseq) != type(self):
- otherseq = apply(bitvec, (otherseq, ) + rest)
+ otherseq = bitvec(otherseq, *rest)
 #sequence is now of our own type
 return BitVec(self._data | otherseq._data, \
 max(self._len, otherseq._len))
@@ -316,7 +316,7 @@
 #needed for *some* of the arithmetic operations
 #rprt('%r.__coerce__%r\n' % (self, (otherseq,) + rest))
 if type(otherseq) != type(self):
- otherseq = apply(bitvec, (otherseq, ) + rest)
+ otherseq = bitvec(otherseq, *rest)
 return self, otherseq
 
 def __int__(self):
Modified: python/branches/p3yk/Demo/metaclasses/Eiffel.py
==============================================================================
--- python/branches/p3yk/Demo/metaclasses/Eiffel.py	(original)
+++ python/branches/p3yk/Demo/metaclasses/Eiffel.py	Fri Mar 17 09:00:19 2006
@@ -82,10 +82,10 @@
 
 def __call__(self, *args, **kw):
 if self.pre:
- apply(self.pre, args, kw)
- Result = apply(self.func, (self.inst,) + args, kw)
+ self.pre(*args, **kw)
+ Result = self.func(self.inst, *args, **kw)
 if self.post:
- apply(self.post, (Result,) + args, kw)
+ self.post(Result, *args, **kw)
 return Result
 
 class EiffelHelper(MetaHelper):
Modified: python/branches/p3yk/Demo/metaclasses/Meta.py
==============================================================================
--- python/branches/p3yk/Demo/metaclasses/Meta.py	(original)
+++ python/branches/p3yk/Demo/metaclasses/Meta.py	Fri Mar 17 09:00:19 2006
@@ -14,7 +14,7 @@
 self.__name__ = self.func.__name__
 
 def __call__(self, *args, **kw):
- return apply(self.func, (self.inst,) + args, kw)
+ return self.func(self.inst, *args, **kw)
 
 class MetaHelper:
 
@@ -86,7 +86,7 @@
 init = inst.__getattr__('__init__')
 except AttributeError:
 init = lambda: None
- apply(init, args, kw)
+ init(*args, **kw)
 return inst
 
 
Modified: python/branches/p3yk/Demo/metaclasses/Simple.py
==============================================================================
--- python/branches/p3yk/Demo/metaclasses/Simple.py	(original)
+++ python/branches/p3yk/Demo/metaclasses/Simple.py	Fri Mar 17 09:00:19 2006
@@ -28,7 +28,7 @@
 self.instance = instance
 def __call__(self, *args):
 print "calling", self.function, "for", self.instance, "with", args
- return apply(self.function, (self.instance,) + args)
+ return self.function(self.instance, *args)
 
 Trace = Tracing('Trace', (), {})
 
Modified: python/branches/p3yk/Demo/metaclasses/Synch.py
==============================================================================
--- python/branches/p3yk/Demo/metaclasses/Synch.py	(original)
+++ python/branches/p3yk/Demo/metaclasses/Synch.py	Fri Mar 17 09:00:19 2006
@@ -148,10 +148,10 @@
 class LockingMethodWrapper(MetaMethodWrapper):
 def __call__(self, *args, **kw):
 if self.__name__[:1] == '_' and self.__name__[1:] != '_':
- return apply(self.func, (self.inst,) + args, kw)
+ return self.func(self.inst, *args, **kw)
 self.inst.__lock__.acquire()
 try:
- return apply(self.func, (self.inst,) + args, kw)
+ return self.func(self.inst, *args, **kw)
 finally:
 self.inst.__lock__.release()
 
Modified: python/branches/p3yk/Demo/metaclasses/Trace.py
==============================================================================
--- python/branches/p3yk/Demo/metaclasses/Trace.py	(original)
+++ python/branches/p3yk/Demo/metaclasses/Trace.py	Fri Mar 17 09:00:19 2006
@@ -50,7 +50,7 @@
 init = inst.__getattr__('__init__')
 except AttributeError:
 init = lambda: None
- apply(init, args, kw)
+ init(*args, **kw)
 return inst
 
 __trace_output__ = None
@@ -85,7 +85,7 @@
 self.func = func
 self.inst = inst
 def __call__(self, *args, **kw):
- return apply(self.func, (self.inst,) + args, kw)
+ return self.func(self.inst, *args, **kw)
 
 class TracingWrapper(NotTracingWrapper):
 def __call__(self, *args, **kw):
@@ -93,7 +93,7 @@
 "calling %s, inst=%s, args=%s, kw=%s",
 self.__name__, self.inst, args, kw)
 try:
- rv = apply(self.func, (self.inst,) + args, kw)
+ rv = self.func(self.inst, *args, **kw)
 except:
 t, v, tb = sys.exc_info()
 self.inst.__trace_call__(self.inst.__trace_output__,
Modified: python/branches/p3yk/Demo/pdist/RCSProxy.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/RCSProxy.py	(original)
+++ python/branches/p3yk/Demo/pdist/RCSProxy.py	Fri Mar 17 09:00:19 2006
@@ -186,7 +186,7 @@
 if hasattr(proxy, what):
 attr = getattr(proxy, what)
 if callable(attr):
- print apply(attr, tuple(sys.argv[2:]))
+ print attr(*sys.argv[2:])
 else:
 print repr(attr)
 else:
Modified: python/branches/p3yk/Demo/pdist/client.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/client.py	(original)
+++ python/branches/p3yk/Demo/pdist/client.py	Fri Mar 17 09:00:19 2006
@@ -132,12 +132,11 @@
 class SecureClient(Client, Security):
 
 def __init__(self, *args):
- import string
- apply(self._pre_init, args)
+ self._pre_init(*args)
 Security.__init__(self)
 self._wf.flush()
 line = self._rf.readline()
- challenge = string.atoi(string.strip(line))
+ challenge = int(line.strip())
 response = self._encode_challenge(challenge)
 line = repr(long(response))
 if line[-1] in 'Ll': line = line[:-1]
Modified: python/branches/p3yk/Demo/pdist/server.py
==============================================================================
--- python/branches/p3yk/Demo/pdist/server.py	(original)
+++ python/branches/p3yk/Demo/pdist/server.py	Fri Mar 17 09:00:19 2006
@@ -81,7 +81,7 @@
 raise NameError, "illegal method name %s" % repr(methodname)
 else:
 method = getattr(self, methodname)
- reply = (None, apply(method, args), id)
+ reply = (None, method(*args), id)
 except:
 reply = (sys.exc_info()[:2], id)
 if id < 0 and reply[:2] == (None, None):
@@ -117,7 +117,7 @@
 class SecureServer(Server, Security):
 
 def __init__(self, *args):
- apply(Server.__init__, (self,) + args)
+ Server.__init__(self, *args)
 Security.__init__(self)
 
 def _verify(self, conn, address):
Modified: python/branches/p3yk/Demo/threads/Coroutine.py
==============================================================================
--- python/branches/p3yk/Demo/threads/Coroutine.py	(original)
+++ python/branches/p3yk/Demo/threads/Coroutine.py	Fri Mar 17 09:00:19 2006
@@ -115,7 +115,7 @@
 if not self.killed:
 try:
 try:
- apply(me.f, args)
+ me.f(*args)
 except Killed:
 pass
 finally:
Modified: python/branches/p3yk/Demo/threads/Generator.py
==============================================================================
--- python/branches/p3yk/Demo/threads/Generator.py	(original)
+++ python/branches/p3yk/Demo/threads/Generator.py	Fri Mar 17 09:00:19 2006
@@ -22,7 +22,7 @@
 self.putlock.acquire()
 if not self.killed:
 try:
- apply(self.func, (self,) + self.args)
+ self.func(self, *self.args)
 except Killed:
 pass
 finally:
Modified: python/branches/p3yk/Demo/threads/find.py
==============================================================================
--- python/branches/p3yk/Demo/threads/find.py	(original)
+++ python/branches/p3yk/Demo/threads/find.py	Fri Mar 17 09:00:19 2006
@@ -17,7 +17,6 @@
 
 import sys
 import getopt
-import string
 import time
 import os
 from stat import *
@@ -85,7 +84,7 @@
 if not job:
 break
 func, args = job
- apply(func, args)
+ func(*args)
 self._donework()
 
 def run(self, nworkers):
@@ -104,7 +103,7 @@
 opts, args = getopt.getopt(sys.argv[1:], '-w:')
 for opt, arg in opts:
 if opt == '-w':
- nworkers = string.atoi(arg)
+ nworkers = int(arg)
 if not args:
 args = [os.curdir]
 
Modified: python/branches/p3yk/Demo/tix/tixwidgets.py
==============================================================================
--- python/branches/p3yk/Demo/tix/tixwidgets.py	(original)
+++ python/branches/p3yk/Demo/tix/tixwidgets.py	Fri Mar 17 09:00:19 2006
@@ -71,8 +71,7 @@
 hm.add_checkbutton(label='BalloonHelp', underline=0, command=ToggleHelp,
 variable=self.useBalloons)
 # The trace variable option doesn't seem to work, instead I use 'command'
- #apply(w.tk.call, ('trace', 'variable', self.useBalloons, 'w',
- # ToggleHelp))
+ #w.tk.call('trace', 'variable', self.useBalloons, 'w', ToggleHelp))
 
 return w
 
Modified: python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/AttrDialog.py	Fri Mar 17 09:00:19 2006
@@ -155,8 +155,7 @@
 def set(self, e=None):
 self.current = self.var.get()
 try:
- apply(self.dialog.widget.pack, (),
- {self.option: self.current})
+ self.dialog.widget.pack(**{self.option: self.current})
 except TclError, msg:
 print msg
 self.refresh()
Modified: python/branches/p3yk/Demo/tkinter/guido/ManPage.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/ManPage.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/ManPage.py	Fri Mar 17 09:00:19 2006
@@ -22,7 +22,7 @@
 # Initialize instance
 def __init__(self, master=None, **cnf):
 # Initialize base class
- apply(ScrolledText.__init__, (self, master), cnf)
+ ScrolledText.__init__(self, master, **cnf)
 
 # Define tags for formatting styles
 self.tag_config('X', underline=1)
@@ -178,7 +178,7 @@
 # Initialize instance
 def __init__(self, master=None, **cnf):
 cnf['state'] = DISABLED
- apply(EditableManPage.__init__, (self, master), cnf)
+ EditableManPage.__init__(self, master, **cnf)
 
 # Alias
 ManPage = ReadonlyManPage
Modified: python/branches/p3yk/Demo/tkinter/guido/ShellWindow.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/ShellWindow.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/ShellWindow.py	Fri Mar 17 09:00:19 2006
@@ -20,7 +20,7 @@
 args = string.split(shell)
 shell = args[0]
 
- apply(ScrolledText.__init__, (self, master), cnf)
+ ScrolledText.__init__(self, master, **cnf)
 self.pos = '1.0'
 self.bind('<Return>', self.inputhandler)
 self.bind('<Control-c>', self.sigint)
Modified: python/branches/p3yk/Demo/tkinter/guido/kill.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/kill.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/kill.py	Fri Mar 17 09:00:19 2006
@@ -9,7 +9,7 @@
 
 class BarButton(Menubutton):
 def __init__(self, master=None, **cnf):
- apply(Menubutton.__init__, (self, master), cnf)
+ Menubutton.__init__(self, master, **cnf)
 self.pack(side=LEFT)
 self.menu = Menu(self, name='menu')
 self['menu'] = self.menu
Modified: python/branches/p3yk/Demo/tkinter/guido/optionmenu.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/optionmenu.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/optionmenu.py	Fri Mar 17 09:00:19 2006
@@ -21,7 +21,7 @@
 var2 = StringVar()
 var2.set(CHOICES[0])
 
-menu2 = apply(OptionMenu, (root, var2) + tuple(CHOICES))
+menu2 = OptionMenu(root, var2, *CHOICES)
 menu2.pack()
 
 root.mainloop()
Modified: python/branches/p3yk/Demo/tkinter/guido/sortvisu.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/sortvisu.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/sortvisu.py	Fri Mar 17 09:00:19 2006
@@ -523,8 +523,7 @@
 if self.size not in sizes:
 sizes.append(self.size)
 sizes.sort()
- self.m_size = apply(OptionMenu,
- (self.botleftframe, self.v_size) + tuple(sizes))
+ self.m_size = OptionMenu(self.botleftframe, self.v_size, *sizes)
 self.m_size.pack(fill=X)
 
 self.v_speed = StringVar(self.master)
Modified: python/branches/p3yk/Demo/tkinter/guido/svkill.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/guido/svkill.py	(original)
+++ python/branches/p3yk/Demo/tkinter/guido/svkill.py	Fri Mar 17 09:00:19 2006
@@ -16,7 +16,7 @@
 
 class BarButton(Menubutton):
 def __init__(self, master=None, **cnf):
- apply(Menubutton.__init__, (self, master), cnf)
+ Menubutton.__init__(self, master, **cnf)
 self.pack(side=LEFT)
 self.menu = Menu(self, name='menu')
 self['menu'] = self.menu
@@ -61,7 +61,7 @@
 def do_1(self, e):
 self.kill(e.widget.get(e.widget.nearest(e.y)))
 def __init__(self, master=None, **cnf):
- apply(Frame.__init__, (self, master), cnf)
+ Frame.__init__(self, master, **cnf)
 self.pack(expand=1, fill=BOTH)
 self.bar = Frame(self, name='bar', relief=RAISED,
 borderwidth=2)
Modified: python/branches/p3yk/Demo/tkinter/matt/window-creation-w-location.py
==============================================================================
--- python/branches/p3yk/Demo/tkinter/matt/window-creation-w-location.py	(original)
+++ python/branches/p3yk/Demo/tkinter/matt/window-creation-w-location.py	Fri Mar 17 09:00:19 2006
@@ -13,7 +13,7 @@
 kwargs["text"] = "QUIT"
 if not kwargs.has_key("command"):
 kwargs["command"] = master.quit
- apply(Button.__init__, (self, master) + args, kwargs)
+ Button.__init__(self, master, *args, **kwargs)
 
 class Test(Frame):
 def makeWindow(self, *args):
Modified: python/branches/p3yk/Doc/api/abstract.tex
==============================================================================
--- python/branches/p3yk/Doc/api/abstract.tex	(original)
+++ python/branches/p3yk/Doc/api/abstract.tex	Fri Mar 17 09:00:19 2006
@@ -235,7 +235,6 @@
 or \NULL{} on failure. This is the equivalent of the Python
 expression \samp{apply(\var{callable_object}, \var{args}, \var{kw})}
 or \samp{\var{callable_object}(*\var{args}, **\var{kw})}.
- \bifuncindex{apply}
 \versionadded{2.2}
 \end{cfuncdesc}
 
@@ -248,7 +247,6 @@
 success, or \NULL{} on failure. This is the equivalent of the
 Python expression \samp{apply(\var{callable_object}, \var{args})} or
 \samp{\var{callable_object}(*\var{args})}.
- \bifuncindex{apply}
 \end{cfuncdesc}
 
 \begin{cfuncdesc}{PyObject*}{PyObject_CallFunction}{PyObject *callable,
@@ -260,7 +258,6 @@
 result of the call on success, or \NULL{} on failure. This is the
 equivalent of the Python expression \samp{apply(\var{callable},
 \var{args})} or \samp{\var{callable}(*\var{args})}.
- \bifuncindex{apply}
 \end{cfuncdesc}
 
 
Modified: python/branches/p3yk/Doc/lib/libfuncs.tex
==============================================================================
--- python/branches/p3yk/Doc/lib/libfuncs.tex	(original)
+++ python/branches/p3yk/Doc/lib/libfuncs.tex	Fri Mar 17 09:00:19 2006
@@ -1169,26 +1169,6 @@
 
 \setindexsubitem{(non-essential built-in functions)}
 
-\begin{funcdesc}{apply}{function, args\optional{, keywords}}
- The \var{function} argument must be a callable object (a
- user-defined or built-in function or method, or a class object) and
- the \var{args} argument must be a sequence. The \var{function} is
- called with \var{args} as the argument list; the number of arguments
- is the length of the tuple.
- If the optional \var{keywords} argument is present, it must be a
- dictionary whose keys are strings. It specifies keyword arguments
- to be added to the end of the argument list.
- Calling \function{apply()} is different from just calling
- \code{\var{function}(\var{args})}, since in that case there is always
- exactly one argument. The use of \function{apply()} is equivalent
- to \code{\var{function}(*\var{args}, **\var{keywords})}.
- Use of \function{apply()} is not necessary since the ``extended call
- syntax,'' as used in the last example, is completely equivalent.
-
- \deprecated{2.3}{Use the extended call syntax instead, as described
- above.}
-\end{funcdesc}
-
 \begin{funcdesc}{buffer}{object\optional{, offset\optional{, size}}}
 The \var{object} argument must be an object that supports the buffer
 call interface (such as strings, arrays, and buffers). A new buffer
Modified: python/branches/p3yk/Lib/bsddb/dbobj.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/dbobj.py	(original)
+++ python/branches/p3yk/Lib/bsddb/dbobj.py	Fri Mar 17 09:00:19 2006
@@ -31,82 +31,82 @@
 
 class DBEnv:
 def __init__(self, *args, **kwargs):
- self._cobj = apply(db.DBEnv, args, kwargs)
+ self._cobj = db.DBEnv(*args, **kwargs)
 
 def close(self, *args, **kwargs):
- return apply(self._cobj.close, args, kwargs)
+ return self._cobj.close(*args, **kwargs)
 def open(self, *args, **kwargs):
- return apply(self._cobj.open, args, kwargs)
+ return self._cobj.open(*args, **kwargs)
 def remove(self, *args, **kwargs):
- return apply(self._cobj.remove, args, kwargs)
+ return self._cobj.remove(*args, **kwargs)
 def set_shm_key(self, *args, **kwargs):
- return apply(self._cobj.set_shm_key, args, kwargs)
+ return self._cobj.set_shm_key(*args, **kwargs)
 def set_cachesize(self, *args, **kwargs):
- return apply(self._cobj.set_cachesize, args, kwargs)
+ return self._cobj.set_cachesize(*args, **kwargs)
 def set_data_dir(self, *args, **kwargs):
- return apply(self._cobj.set_data_dir, args, kwargs)
+ return self._cobj.set_data_dir(*args, **kwargs)
 def set_flags(self, *args, **kwargs):
- return apply(self._cobj.set_flags, args, kwargs)
+ return self._cobj.set_flags(*args, **kwargs)
 def set_lg_bsize(self, *args, **kwargs):
- return apply(self._cobj.set_lg_bsize, args, kwargs)
+ return self._cobj.set_lg_bsize(*args, **kwargs)
 def set_lg_dir(self, *args, **kwargs):
- return apply(self._cobj.set_lg_dir, args, kwargs)
+ return self._cobj.set_lg_dir(*args, **kwargs)
 def set_lg_max(self, *args, **kwargs):
- return apply(self._cobj.set_lg_max, args, kwargs)
+ return self._cobj.set_lg_max(*args, **kwargs)
 def set_lk_detect(self, *args, **kwargs):
- return apply(self._cobj.set_lk_detect, args, kwargs)
+ return self._cobj.set_lk_detect(*args, **kwargs)
 def set_lk_max(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max, args, kwargs)
+ return self._cobj.set_lk_max(*args, **kwargs)
 def set_lk_max_locks(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max_locks, args, kwargs)
+ return self._cobj.set_lk_max_locks(*args, **kwargs)
 def set_lk_max_lockers(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max_lockers, args, kwargs)
+ return self._cobj.set_lk_max_lockers(*args, **kwargs)
 def set_lk_max_objects(self, *args, **kwargs):
- return apply(self._cobj.set_lk_max_objects, args, kwargs)
+ return self._cobj.set_lk_max_objects(*args, **kwargs)
 def set_mp_mmapsize(self, *args, **kwargs):
- return apply(self._cobj.set_mp_mmapsize, args, kwargs)
+ return self._cobj.set_mp_mmapsize(*args, **kwargs)
 def set_timeout(self, *args, **kwargs):
- return apply(self._cobj.set_timeout, args, kwargs)
+ return self._cobj.set_timeout(*args, **kwargs)
 def set_tmp_dir(self, *args, **kwargs):
- return apply(self._cobj.set_tmp_dir, args, kwargs)
+ return self._cobj.set_tmp_dir(*args, **kwargs)
 def txn_begin(self, *args, **kwargs):
- return apply(self._cobj.txn_begin, args, kwargs)
+ return self._cobj.txn_begin(*args, **kwargs)
 def txn_checkpoint(self, *args, **kwargs):
- return apply(self._cobj.txn_checkpoint, args, kwargs)
+ return self._cobj.txn_checkpoint(*args, **kwargs)
 def txn_stat(self, *args, **kwargs):
- return apply(self._cobj.txn_stat, args, kwargs)
+ return self._cobj.txn_stat(*args, **kwargs)
 def set_tx_max(self, *args, **kwargs):
- return apply(self._cobj.set_tx_max, args, kwargs)
+ return self._cobj.set_tx_max(*args, **kwargs)
 def set_tx_timestamp(self, *args, **kwargs):
- return apply(self._cobj.set_tx_timestamp, args, kwargs)
+ return self._cobj.set_tx_timestamp(*args, **kwargs)
 def lock_detect(self, *args, **kwargs):
- return apply(self._cobj.lock_detect, args, kwargs)
+ return self._cobj.lock_detect(*args, **kwargs)
 def lock_get(self, *args, **kwargs):
- return apply(self._cobj.lock_get, args, kwargs)
+ return self._cobj.lock_get(*args, **kwargs)
 def lock_id(self, *args, **kwargs):
- return apply(self._cobj.lock_id, args, kwargs)
+ return self._cobj.lock_id(*args, **kwargs)
 def lock_put(self, *args, **kwargs):
- return apply(self._cobj.lock_put, args, kwargs)
+ return self._cobj.lock_put(*args, **kwargs)
 def lock_stat(self, *args, **kwargs):
- return apply(self._cobj.lock_stat, args, kwargs)
+ return self._cobj.lock_stat(*args, **kwargs)
 def log_archive(self, *args, **kwargs):
- return apply(self._cobj.log_archive, args, kwargs)
+ return self._cobj.log_archive(*args, **kwargs)
 def set_get_returns_none(self, *args, **kwargs):
- return apply(self._cobj.set_get_returns_none, args, kwargs)
+ return self._cobj.set_get_returns_none(*args, **kwargs)
 
 if db.version() >= (4,1):
 def dbremove(self, *args, **kwargs):
- return apply(self._cobj.dbremove, args, kwargs)
+ return self._cobj.dbremove(*args, **kwargs)
 def dbrename(self, *args, **kwargs):
- return apply(self._cobj.dbrename, args, kwargs)
+ return self._cobj.dbrename(*args, **kwargs)
 def set_encrypt(self, *args, **kwargs):
- return apply(self._cobj.set_encrypt, args, kwargs)
+ return self._cobj.set_encrypt(*args, **kwargs)
 
 
 class DB(DictMixin):
 def __init__(self, dbenv, *args, **kwargs):
 # give it the proper DBEnv C object that its expecting
- self._cobj = apply(db.DB, (dbenv._cobj,) + args, kwargs)
+ self._cobj = db.DB(dbenv._cobj, *args, **kwargs)
 
 # TODO are there other dict methods that need to be overridden?
 def __len__(self):
@@ -119,92 +119,92 @@
 del self._cobj[arg]
 
 def append(self, *args, **kwargs):
- return apply(self._cobj.append, args, kwargs)
+ return self._cobj.append(*args, **kwargs)
 def associate(self, *args, **kwargs):
- return apply(self._cobj.associate, args, kwargs)
+ return self._cobj.associate(*args, **kwargs)
 def close(self, *args, **kwargs):
- return apply(self._cobj.close, args, kwargs)
+ return self._cobj.close(*args, **kwargs)
 def consume(self, *args, **kwargs):
- return apply(self._cobj.consume, args, kwargs)
+ return self._cobj.consume(*args, **kwargs)
 def consume_wait(self, *args, **kwargs):
- return apply(self._cobj.consume_wait, args, kwargs)
+ return self._cobj.consume_wait(*args, **kwargs)
 def cursor(self, *args, **kwargs):
- return apply(self._cobj.cursor, args, kwargs)
+ return self._cobj.cursor(*args, **kwargs)
 def delete(self, *args, **kwargs):
- return apply(self._cobj.delete, args, kwargs)
+ return self._cobj.delete(*args, **kwargs)
 def fd(self, *args, **kwargs):
- return apply(self._cobj.fd, args, kwargs)
+ return self._cobj.fd(*args, **kwargs)
 def get(self, *args, **kwargs):
- return apply(self._cobj.get, args, kwargs)
+ return self._cobj.get(*args, **kwargs)
 def pget(self, *args, **kwargs):
- return apply(self._cobj.pget, args, kwargs)
+ return self._cobj.pget(*args, **kwargs)
 def get_both(self, *args, **kwargs):
- return apply(self._cobj.get_both, args, kwargs)
+ return self._cobj.get_both(*args, **kwargs)
 def get_byteswapped(self, *args, **kwargs):
- return apply(self._cobj.get_byteswapped, args, kwargs)
+ return self._cobj.get_byteswapped(*args, **kwargs)
 def get_size(self, *args, **kwargs):
- return apply(self._cobj.get_size, args, kwargs)
+ return self._cobj.get_size(*args, **kwargs)
 def get_type(self, *args, **kwargs):
- return apply(self._cobj.get_type, args, kwargs)
+ return self._cobj.get_type(*args, **kwargs)
 def join(self, *args, **kwargs):
- return apply(self._cobj.join, args, kwargs)
+ return self._cobj.join(*args, **kwargs)
 def key_range(self, *args, **kwargs):
- return apply(self._cobj.key_range, args, kwargs)
+ return self._cobj.key_range(*args, **kwargs)
 def has_key(self, *args, **kwargs):
- return apply(self._cobj.has_key, args, kwargs)
+ return self._cobj.has_key(*args, **kwargs)
 def items(self, *args, **kwargs):
- return apply(self._cobj.items, args, kwargs)
+ return self._cobj.items(*args, **kwargs)
 def keys(self, *args, **kwargs):
- return apply(self._cobj.keys, args, kwargs)
+ return self._cobj.keys(*args, **kwargs)
 def open(self, *args, **kwargs):
- return apply(self._cobj.open, args, kwargs)
+ return self._cobj.open(*args, **kwargs)
 def put(self, *args, **kwargs):
- return apply(self._cobj.put, args, kwargs)
+ return self._cobj.put(*args, **kwargs)
 def remove(self, *args, **kwargs):
- return apply(self._cobj.remove, args, kwargs)
+ return self._cobj.remove(*args, **kwargs)
 def rename(self, *args, **kwargs):
- return apply(self._cobj.rename, args, kwargs)
+ return self._cobj.rename(*args, **kwargs)
 def set_bt_minkey(self, *args, **kwargs):
- return apply(self._cobj.set_bt_minkey, args, kwargs)
+ return self._cobj.set_bt_minkey(*args, **kwargs)
 def set_bt_compare(self, *args, **kwargs):
- return apply(self._cobj.set_bt_compare, args, kwargs)
+ return self._cobj.set_bt_compare(*args, **kwargs)
 def set_cachesize(self, *args, **kwargs):
- return apply(self._cobj.set_cachesize, args, kwargs)
+ return self._cobj.set_cachesize(*args, **kwargs)
 def set_flags(self, *args, **kwargs):
- return apply(self._cobj.set_flags, args, kwargs)
+ return self._cobj.set_flags(*args, **kwargs)
 def set_h_ffactor(self, *args, **kwargs):
- return apply(self._cobj.set_h_ffactor, args, kwargs)
+ return self._cobj.set_h_ffactor(*args, **kwargs)
 def set_h_nelem(self, *args, **kwargs):
- return apply(self._cobj.set_h_nelem, args, kwargs)
+ return self._cobj.set_h_nelem(*args, **kwargs)
 def set_lorder(self, *args, **kwargs):
- return apply(self._cobj.set_lorder, args, kwargs)
+ return self._cobj.set_lorder(*args, **kwargs)
 def set_pagesize(self, *args, **kwargs):
- return apply(self._cobj.set_pagesize, args, kwargs)
+ return self._cobj.set_pagesize(*args, **kwargs)
 def set_re_delim(self, *args, **kwargs):
- return apply(self._cobj.set_re_delim, args, kwargs)
+ return self._cobj.set_re_delim(*args, **kwargs)
 def set_re_len(self, *args, **kwargs):
- return apply(self._cobj.set_re_len, args, kwargs)
+ return self._cobj.set_re_len(*args, **kwargs)
 def set_re_pad(self, *args, **kwargs):
- return apply(self._cobj.set_re_pad, args, kwargs)
+ return self._cobj.set_re_pad(*args, **kwargs)
 def set_re_source(self, *args, **kwargs):
- return apply(self._cobj.set_re_source, args, kwargs)
+ return self._cobj.set_re_source(*args, **kwargs)
 def set_q_extentsize(self, *args, **kwargs):
- return apply(self._cobj.set_q_extentsize, args, kwargs)
+ return self._cobj.set_q_extentsize(*args, **kwargs)
 def stat(self, *args, **kwargs):
- return apply(self._cobj.stat, args, kwargs)
+ return self._cobj.stat(*args, **kwargs)
 def sync(self, *args, **kwargs):
- return apply(self._cobj.sync, args, kwargs)
+ return self._cobj.sync(*args, **kwargs)
 def type(self, *args, **kwargs):
- return apply(self._cobj.type, args, kwargs)
+ return self._cobj.type(*args, **kwargs)
 def upgrade(self, *args, **kwargs):
- return apply(self._cobj.upgrade, args, kwargs)
+ return self._cobj.upgrade(*args, **kwargs)
 def values(self, *args, **kwargs):
- return apply(self._cobj.values, args, kwargs)
+ return self._cobj.values(*args, **kwargs)
 def verify(self, *args, **kwargs):
- return apply(self._cobj.verify, args, kwargs)
+ return self._cobj.verify(*args, **kwargs)
 def set_get_returns_none(self, *args, **kwargs):
- return apply(self._cobj.set_get_returns_none, args, kwargs)
+ return self._cobj.set_get_returns_none(*args, **kwargs)
 
 if db.version() >= (4,1):
 def set_encrypt(self, *args, **kwargs):
- return apply(self._cobj.set_encrypt, args, kwargs)
+ return self._cobj.set_encrypt(*args, **kwargs)
Modified: python/branches/p3yk/Lib/bsddb/dbshelve.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/dbshelve.py	(original)
+++ python/branches/p3yk/Lib/bsddb/dbshelve.py	Fri Mar 17 09:00:19 2006
@@ -169,7 +169,7 @@
 # given nothing is passed to the extension module. That way
 # an exception can be raised if set_get_returns_none is turned
 # off.
- data = apply(self.db.get, args, kw)
+ data = self.db.get(*args, **kw)
 try:
 return cPickle.loads(data)
 except (TypeError, cPickle.UnpicklingError):
@@ -236,7 +236,7 @@
 def get(self, *args):
 count = len(args) # a method overloading hack
 method = getattr(self, 'get_%d' % count)
- apply(method, args)
+ method(*args)
 
 def get_1(self, flags):
 rec = self.dbc.get(flags)
Modified: python/branches/p3yk/Lib/bsddb/test/test_basics.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_basics.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_basics.py	Fri Mar 17 09:00:19 2006
@@ -444,7 +444,7 @@
 print "attempting to use a closed cursor's %s method" % \
 method
 # a bug may cause a NULL pointer dereference...
- apply(getattr(c, method), args)
+ getattr(c, method)(*args)
 except db.DBError, val:
 assert val[0] == 0
 if verbose: print val
Modified: python/branches/p3yk/Lib/bsddb/test/test_dbobj.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_dbobj.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_dbobj.py	Fri Mar 17 09:00:19 2006
@@ -39,7 +39,7 @@
 def put(self, key, *args, **kwargs):
 key = string.upper(key)
 # call our parent classes put method with an upper case key
- return apply(dbobj.DB.put, (self, key) + args, kwargs)
+ return dbobj.DB.put(self, key, *args, **kwargs)
 self.env = TestDBEnv()
 self.env.open(self.homeDir, db.DB_CREATE | db.DB_INIT_MPOOL)
 self.db = TestDB(self.env)
Modified: python/branches/p3yk/Lib/bsddb/test/test_join.py
==============================================================================
--- python/branches/p3yk/Lib/bsddb/test/test_join.py	(original)
+++ python/branches/p3yk/Lib/bsddb/test/test_join.py	Fri Mar 17 09:00:19 2006
@@ -72,13 +72,13 @@
 # create and populate primary index
 priDB = db.DB(self.env)
 priDB.open(self.filename, "primary", db.DB_BTREE, db.DB_CREATE)
- map(lambda t, priDB=priDB: apply(priDB.put, t), ProductIndex)
+ map(lambda t, priDB=priDB: priDB.put(*t), ProductIndex)
 
 # create and populate secondary index
 secDB = db.DB(self.env)
 secDB.set_flags(db.DB_DUP | db.DB_DUPSORT)
 secDB.open(self.filename, "secondary", db.DB_BTREE, db.DB_CREATE)
- map(lambda t, secDB=secDB: apply(secDB.put, t), ColorIndex)
+ map(lambda t, secDB=secDB: secDB.put(*t), ColorIndex)
 
 sCursor = None
 jCursor = None
Modified: python/branches/p3yk/Lib/compiler/transformer.py
==============================================================================
--- python/branches/p3yk/Lib/compiler/transformer.py	(original)
+++ python/branches/p3yk/Lib/compiler/transformer.py	Fri Mar 17 09:00:19 2006
@@ -90,7 +90,7 @@
 raise
 else:
 raise WalkerError, "Can't find appropriate Node type: %s" % str(args)
- #return apply(ast.Node, args)
+ #return ast.Node(*args)
 
 class Transformer:
 """Utility object for transforming Python parse trees.
Modified: python/branches/p3yk/Lib/distutils/archive_util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/archive_util.py	(original)
+++ python/branches/p3yk/Lib/distutils/archive_util.py	Fri Mar 17 09:00:19 2006
@@ -162,7 +162,7 @@
 func = format_info[0]
 for (arg,val) in format_info[1]:
 kwargs[arg] = val
- filename = apply(func, (base_name, base_dir), kwargs)
+ filename = func(base_name, base_dir, **kwargs)
 
 if root_dir is not None:
 log.debug("changing back to '%s'", save_cwd)
Modified: python/branches/p3yk/Lib/distutils/command/build_ext.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/command/build_ext.py	(original)
+++ python/branches/p3yk/Lib/distutils/command/build_ext.py	Fri Mar 17 09:00:19 2006
@@ -613,8 +613,8 @@
 # extensions in debug_mode are named 'module_d.pyd' under windows
 so_ext = get_config_var('SO')
 if os.name == 'nt' and self.debug:
- return apply(os.path.join, ext_path) + '_d' + so_ext
- return apply(os.path.join, ext_path) + so_ext
+ return os.path.join(*ext_path) + '_d' + so_ext
+ return os.path.join(*ext_path) + so_ext
 
 def get_export_symbols (self, ext):
 """Return the list of symbols that a shared extension has to
Modified: python/branches/p3yk/Lib/distutils/command/build_py.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/command/build_py.py	(original)
+++ python/branches/p3yk/Lib/distutils/command/build_py.py	Fri Mar 17 09:00:19 2006
@@ -154,7 +154,7 @@
 
 if not self.package_dir:
 if path:
- return apply(os.path.join, path)
+ return os.path.join(*path)
 else:
 return ''
 else:
@@ -167,7 +167,7 @@
 del path[-1]
 else:
 tail.insert(0, pdir)
- return apply(os.path.join, tail)
+ return os.path.join(*tail)
 else:
 # Oops, got all the way through 'path' without finding a
 # match in package_dir. If package_dir defines a directory
@@ -181,7 +181,7 @@
 tail.insert(0, pdir)
 
 if tail:
- return apply(os.path.join, tail)
+ return os.path.join(*tail)
 else:
 return ''
 
@@ -335,7 +335,7 @@
 
 def get_module_outfile (self, build_dir, package, module):
 outfile_path = [build_dir] + list(package) + [module + ".py"]
- return apply(os.path.join, outfile_path)
+ return os.path.join(*outfile_path)
 
 
 def get_outputs (self, include_bytecode=1):
Modified: python/branches/p3yk/Lib/distutils/dir_util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/dir_util.py	(original)
+++ python/branches/p3yk/Lib/distutils/dir_util.py	Fri Mar 17 09:00:19 2006
@@ -204,7 +204,7 @@
 _build_cmdtuple(directory, cmdtuples)
 for cmd in cmdtuples:
 try:
- apply(cmd[0], (cmd[1],))
+ cmd[0](cmd[1])
 # remove dir from cache if it's already there
 abspath = os.path.abspath(cmd[1])
 if _path_created.has_key(abspath):
Modified: python/branches/p3yk/Lib/distutils/filelist.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/filelist.py	(original)
+++ python/branches/p3yk/Lib/distutils/filelist.py	Fri Mar 17 09:00:19 2006
@@ -69,7 +69,7 @@
 sortable_files.sort()
 self.files = []
 for sort_tuple in sortable_files:
- self.files.append(apply(os.path.join, sort_tuple))
+ self.files.append(os.path.join(*sort_tuple))
 
 
 # -- Other miscellaneous utility methods ---------------------------
Modified: python/branches/p3yk/Lib/distutils/util.py
==============================================================================
--- python/branches/p3yk/Lib/distutils/util.py	(original)
+++ python/branches/p3yk/Lib/distutils/util.py	Fri Mar 17 09:00:19 2006
@@ -95,7 +95,7 @@
 paths.remove('.')
 if not paths:
 return os.curdir
- return apply(os.path.join, paths)
+ return os.path.join(*paths)
 
 # convert_path ()
 
@@ -295,7 +295,7 @@
 
 log.info(msg)
 if not dry_run:
- apply(func, args)
+ func(*args)
 
 
 def strtobool (val):
Modified: python/branches/p3yk/Lib/idlelib/MultiCall.py
==============================================================================
--- python/branches/p3yk/Lib/idlelib/MultiCall.py	(original)
+++ python/branches/p3yk/Lib/idlelib/MultiCall.py	Fri Mar 17 09:00:19 2006
@@ -296,7 +296,7 @@
 assert issubclass(widget, Tkinter.Misc)
 
 def __init__(self, *args, **kwargs):
- apply(widget.__init__, (self,)+args, kwargs)
+ widget.__init__(self, *args, **kwargs)
 # a dictionary which maps a virtual event to a tuple with:
 # 0. the function binded
 # 1. a list of triplets - the sequences it is binded to
Modified: python/branches/p3yk/Lib/logging/__init__.py
==============================================================================
--- python/branches/p3yk/Lib/logging/__init__.py	(original)
+++ python/branches/p3yk/Lib/logging/__init__.py	Fri Mar 17 09:00:19 2006
@@ -965,7 +965,7 @@
 if self.manager.disable >= DEBUG:
 return
 if DEBUG >= self.getEffectiveLevel():
- apply(self._log, (DEBUG, msg, args), kwargs)
+ self._log(DEBUG, msg, args, **kwargs)
 
 def info(self, msg, *args, **kwargs):
 """
@@ -979,7 +979,7 @@
 if self.manager.disable >= INFO:
 return
 if INFO >= self.getEffectiveLevel():
- apply(self._log, (INFO, msg, args), kwargs)
+ self._log(INFO, msg, args, **kwargs)
 
 def warning(self, msg, *args, **kwargs):
 """
@@ -993,7 +993,7 @@
 if self.manager.disable >= WARNING:
 return
 if self.isEnabledFor(WARNING):
- apply(self._log, (WARNING, msg, args), kwargs)
+ self._log(WARNING, msg, args, **kwargs)
 
 warn = warning
 
@@ -1009,13 +1009,13 @@
 if self.manager.disable >= ERROR:
 return
 if self.isEnabledFor(ERROR):
- apply(self._log, (ERROR, msg, args), kwargs)
+ self._log(ERROR, msg, args, **kwargs)
 
 def exception(self, msg, *args):
 """
 Convenience method for logging an ERROR with exception information.
 """
- apply(self.error, (msg,) + args, {'exc_info': 1})
+ self.error(msg, *args, exc_info=1)
 
 def critical(self, msg, *args, **kwargs):
 """
@@ -1029,7 +1029,7 @@
 if self.manager.disable >= CRITICAL:
 return
 if CRITICAL >= self.getEffectiveLevel():
- apply(self._log, (CRITICAL, msg, args), kwargs)
+ self._log(CRITICAL, msg, args, **kwargs)
 
 fatal = critical
 
@@ -1050,7 +1050,7 @@
 if self.manager.disable >= level:
 return
 if self.isEnabledFor(level):
- apply(self._log, (level, msg, args), kwargs)
+ self._log(level, msg, args, **kwargs)
 
 def findCaller(self):
 """
@@ -1275,7 +1275,7 @@
 """
 if len(root.handlers) == 0:
 basicConfig()
- apply(root.critical, (msg,)+args, kwargs)
+ root.critical(msg, *args, **kwargs)
 
 fatal = critical
 
@@ -1285,14 +1285,14 @@
 """
 if len(root.handlers) == 0:
 basicConfig()
- apply(root.error, (msg,)+args, kwargs)
+ root.error(msg, *args, **kwargs)
 
 def exception(msg, *args):
 """
 Log a message with severity 'ERROR' on the root logger,
 with exception information.
 """
- apply(error, (msg,)+args, {'exc_info': 1})
+ error(msg, *args, exc_info=1)
 
 def warning(msg, *args, **kwargs):
 """
@@ -1300,7 +1300,7 @@
 """
 if len(root.handlers) == 0:
 basicConfig()
- apply(root.warning, (msg,)+args, kwargs)
+ root.warning(msg, *args, **kwargs)
 
 warn = warning
 
@@ -1310,7 +1310,7 @@
 """
 if len(root.handlers) == 0:
 basicConfig()
- apply(root.info, (msg,)+args, kwargs)
+ root.info(msg, *args, **kwargs)
 
 def debug(msg, *args, **kwargs):
 """
@@ -1318,7 +1318,7 @@
 """
 if len(root.handlers) == 0:
 basicConfig()
- apply(root.debug, (msg,)+args, kwargs)
+ root.debug(msg, *args, **kwargs)
 
 def log(level, msg, *args, **kwargs):
 """
@@ -1326,7 +1326,7 @@
 """
 if len(root.handlers) == 0:
 basicConfig()
- apply(root.log, (level, msg)+args, kwargs)
+ root.log(level, msg, *args, **kwargs)
 
 def disable(level):
 """
Modified: python/branches/p3yk/Lib/logging/config.py
==============================================================================
--- python/branches/p3yk/Lib/logging/config.py	(original)
+++ python/branches/p3yk/Lib/logging/config.py	Fri Mar 17 09:00:19 2006
@@ -148,7 +148,7 @@
 klass = eval(klass, vars(logging))
 args = cp.get(sectname, "args")
 args = eval(args, vars(logging))
- h = apply(klass, args)
+ h = klass(*args)
 if "level" in opts:
 level = cp.get(sectname, "level")
 h.setLevel(logging._levelNames[level])
Modified: python/branches/p3yk/Lib/plat-mac/gensuitemodule.py
==============================================================================
--- python/branches/p3yk/Lib/plat-mac/gensuitemodule.py	(original)
+++ python/branches/p3yk/Lib/plat-mac/gensuitemodule.py	Fri Mar 17 09:00:19 2006
@@ -351,11 +351,11 @@
 
 def generic(what, f, *args):
 if type(what) == types.FunctionType:
- return apply(what, (f,) + args)
+ return what(f, *args)
 if type(what) == types.ListType:
 record = []
 for thing in what:
- item = apply(generic, thing[:1] + (f,) + thing[1:])
+ item = generic(thing[:1], f, *thing[1:])
 record.append((thing[1], item))
 return record
 return "BAD GENERIC ARGS: %r" % (what,)
Modified: python/branches/p3yk/Lib/subprocess.py
==============================================================================
--- python/branches/p3yk/Lib/subprocess.py	(original)
+++ python/branches/p3yk/Lib/subprocess.py	Fri Mar 17 09:00:19 2006
@@ -995,7 +995,7 @@
 os.chdir(cwd)
 
 if preexec_fn:
- apply(preexec_fn)
+ preexec_fn()
 
 if env is None:
 os.execvp(executable, args)
Deleted: /python/branches/p3yk/Lib/test/crashers/infinite_rec_4.py
==============================================================================
--- /python/branches/p3yk/Lib/test/crashers/infinite_rec_4.py	Fri Mar 17 09:00:19 2006
+++ (empty file)
@@ -1,7 +0,0 @@
-
-# http://python.org/sf/1202533
-
-if __name__ == '__main__':
- lst = [apply]
- lst.append(lst)
- apply(*lst) # segfault: infinite recursion in C
Modified: python/branches/p3yk/Lib/test/test_builtin.py
==============================================================================
--- python/branches/p3yk/Lib/test/test_builtin.py	(original)
+++ python/branches/p3yk/Lib/test/test_builtin.py	Fri Mar 17 09:00:19 2006
@@ -153,32 +153,6 @@
 S = [10, 20, 30]
 self.assertEqual(any(x > 42 for x in S), False)
 
- def test_apply(self):
- def f0(*args):
- self.assertEqual(args, ())
- def f1(a1):
- self.assertEqual(a1, 1)
- def f2(a1, a2):
- self.assertEqual(a1, 1)
- self.assertEqual(a2, 2)
- def f3(a1, a2, a3):
- self.assertEqual(a1, 1)
- self.assertEqual(a2, 2)
- self.assertEqual(a3, 3)
- apply(f0, ())
- apply(f1, (1,))
- apply(f2, (1, 2))
- apply(f3, (1, 2, 3))
-
- # A PyCFunction that takes only positional parameters should allow an
- # empty keyword dictionary to pass without a complaint, but raise a
- # TypeError if the dictionary is non-empty.
- apply(id, (1,), {})
- self.assertRaises(TypeError, apply, id, (1,), {"foo": 1})
- self.assertRaises(TypeError, apply)
- self.assertRaises(TypeError, apply, id, 42)
- self.assertRaises(TypeError, apply, id, (42,), 42)
-
 def test_callable(self):
 self.assert_(callable(len))
 def f(): pass
Modified: python/branches/p3yk/Mac/Demo/sound/morse.py
==============================================================================
--- python/branches/p3yk/Mac/Demo/sound/morse.py	(original)
+++ python/branches/p3yk/Mac/Demo/sound/morse.py	Fri Mar 17 09:00:19 2006
@@ -78,7 +78,7 @@
 class BufferedAudioDev:
 def __init__(self, *args):
 import audiodev
- self._base = apply(audiodev.AudioDev, args)
+ self._base = audiodev.AudioDev(*args)
 self._buffer = []
 self._filled = 0
 self._addmethods(self._base, self._base.__class__)
Modified: python/branches/p3yk/Mac/Tools/IDE/ProfileBrowser.py
==============================================================================
--- python/branches/p3yk/Mac/Tools/IDE/ProfileBrowser.py	(original)
+++ python/branches/p3yk/Mac/Tools/IDE/ProfileBrowser.py	Fri Mar 17 09:00:19 2006
@@ -65,7 +65,7 @@
 
 def displaystats(self):
 W.SetCursor('watch')
- apply(self.stats.sort_stats, self.sortkeys)
+ self.stats.sort_stats(*self.sortkeys)
 saveout = sys.stdout
 try:
 s = sys.stdout = StringIO.StringIO()
Modified: python/branches/p3yk/Mac/Tools/IDE/PyConsole.py
==============================================================================
--- python/branches/p3yk/Mac/Tools/IDE/PyConsole.py	(original)
+++ python/branches/p3yk/Mac/Tools/IDE/PyConsole.py	Fri Mar 17 09:00:19 2006
@@ -26,7 +26,7 @@
 class ConsoleTextWidget(W.EditText):
 
 def __init__(self, *args, **kwargs):
- apply(W.EditText.__init__, (self,) + args, kwargs)
+ W.EditText.__init__(self, *args, **kwargs)
 self._inputstart = 0
 self._buf = ''
 self.pyinteractive = PyInteractive.PyInteractive()
Modified: python/branches/p3yk/Mac/Tools/IDE/PyDebugger.py
==============================================================================
--- python/branches/p3yk/Mac/Tools/IDE/PyDebugger.py	(original)
+++ python/branches/p3yk/Mac/Tools/IDE/PyDebugger.py	Fri Mar 17 09:00:19 2006
@@ -652,7 +652,7 @@
 class SourceViewer(W.PyEditor):
 
 def __init__(self, *args, **kwargs):
- apply(W.PyEditor.__init__, (self,) + args, kwargs)
+ W.PyEditor.__init__(self, *args, **kwargs)
 self.bind('<click>', self.clickintercept)
 
 def clickintercept(self, point, modifiers):
@@ -815,7 +815,7 @@
 class TracingMonitor(W.Widget):
 
 def __init__(self, *args, **kwargs):
- apply(W.Widget.__init__, (self,) + args, kwargs)
+ W.Widget.__init__(self, *args, **kwargs)
 self.state = 0
 
 def toggle(self):
Modified: python/branches/p3yk/Mac/Tools/IDE/Wapplication.py
==============================================================================
--- python/branches/p3yk/Mac/Tools/IDE/Wapplication.py	(original)
+++ python/branches/p3yk/Mac/Tools/IDE/Wapplication.py	Fri Mar 17 09:00:19 2006
@@ -129,7 +129,7 @@
 window = self._windows[wid]
 if hasattr(window, attr):
 handler = getattr(window, attr)
- apply(handler, args)
+ handler(*args)
 return 1
 
 def getfrontwindow(self):
Modified: python/branches/p3yk/Mac/Tools/IDE/Wbase.py
==============================================================================
--- python/branches/p3yk/Mac/Tools/IDE/Wbase.py	(original)
+++ python/branches/p3yk/Mac/Tools/IDE/Wbase.py	Fri Mar 17 09:00:19 2006
@@ -78,7 +78,7 @@
 if type(args[0]) == FunctionType or type(args[0]) == MethodType:
 self._possize = args[0]
 else:
- apply(self.resize, args[0])
+ self.resize(*args[0])
 elif len(args) == 2:
 self._possize = (0, 0) + args
 elif len(args) == 4:
@@ -175,37 +175,37 @@
 
 def forall(self, methodname, *args):
 for w in self._widgets:
- rv = apply(w.forall, (methodname,) + args)
+ rv = w.forall(methodname, *args)
 if rv:
 return rv
 if self._bindings.has_key("<" + methodname + ">"):
 callback = self._bindings["<" + methodname + ">"]
- rv = apply(callback, args)
+ rv = callback(*args)
 if rv:
 return rv
 if hasattr(self, methodname):
 method = getattr(self, methodname)
- return apply(method, args)
+ return method(*args)
 
 def forall_butself(self, methodname, *args):
 for w in self._widgets:
- rv = apply(w.forall, (methodname,) + args)
+ rv = w.forall(methodname, *args)
 if rv:
 return rv
 
 def forall_frombottom(self, methodname, *args):
 if self._bindings.has_key("<" + methodname + ">"):
 callback = self._bindings["<" + methodname + ">"]
- rv = apply(callback, args)
+ rv = callback(*args)
 if rv:
 return rv
 if hasattr(self, methodname):
 method = getattr(self, methodname)
- rv = apply(method, args)
+ rv = method(*args)
 if rv:
 return rv
 for w in self._widgets:
- rv = apply(w.forall_frombottom, (methodname,) + args)
+ rv = w.forall_frombottom(methodname, *args)
 if rv:
 return rv
 
@@ -670,7 +670,7 @@
 maxargs = func.func_code.co_argcount - 1
 else:
 if callable(callback):
- return apply(callback, args)
+ return callback(*args)
 else:
 raise TypeError, "uncallable callback object"
 
@@ -679,7 +679,7 @@
 else:
 minargs = maxargs
 if minargs <= len(args) <= maxargs:
- return apply(callback, args)
+ return callback(*args)
 elif not mustfit and minargs == 0:
 return callback()
 else:
Modified: python/branches/p3yk/Mac/Tools/macfreeze/macgen_bin.py
==============================================================================
--- python/branches/p3yk/Mac/Tools/macfreeze/macgen_bin.py	(original)
+++ python/branches/p3yk/Mac/Tools/macfreeze/macgen_bin.py	Fri Mar 17 09:00:19 2006
@@ -180,7 +180,7 @@
 output = Res.FSpOpenResFile(output, 3)
 openedout = 1
 try:
- apply(buildtools.copyres, (input, output) + args, kwargs)
+ buildtools.copyres(input, output, *args, **kwargs)
 finally:
 if openedin:
 Res.CloseResFile(input)
Modified: python/branches/p3yk/Mac/scripts/buildpkg.py
==============================================================================
--- python/branches/p3yk/Mac/scripts/buildpkg.py	(original)
+++ python/branches/p3yk/Mac/scripts/buildpkg.py	Fri Mar 17 09:00:19 2006
@@ -374,7 +374,7 @@
 o = options
 title, version, desc = o["Title"], o["Version"], o["Description"]
 pm = PackageMaker(title, version, desc)
- apply(pm.build, list(args), options)
+ pm.build(*args, **options)
 
 
 ######################################################################
@@ -468,7 +468,7 @@
 "Description" in ok):
 print "Missing mandatory option!"
 else:
- apply(buildPackage, args, optsDict)
+ buildPackage(*args, **optsDict)
 return
 
 printUsage()
Modified: python/branches/p3yk/PCbuild/readme.txt
==============================================================================
--- python/branches/p3yk/PCbuild/readme.txt	(original)
+++ python/branches/p3yk/PCbuild/readme.txt	Fri Mar 17 09:00:19 2006
@@ -204,7 +204,7 @@
 XXX File "C:\Code\python\lib\threading.py", line 411, in __bootstrap
 XXX self.run()
 XXX File "C:\Code\python\lib\threading.py", line 399, in run
- XXX apply(self.__target, self.__args, self.__kwargs)
+ XXX self.__target(*self.__args, **self.__kwargs)
 XXX File "C:\Code\python\lib\bsddb\test\test_thread.py", line 268, in
 XXX readerThread
 XXX rec = c.next()
Modified: python/branches/p3yk/Python/bltinmodule.c
==============================================================================
--- python/branches/p3yk/Python/bltinmodule.c	(original)
+++ python/branches/p3yk/Python/bltinmodule.c	Fri Mar 17 09:00:19 2006
@@ -133,50 +133,6 @@
 \n\
 Return True if bool(x) is True for any x in the iterable.");
 
-static PyObject *
-builtin_apply(PyObject *self, PyObject *args)
-{
-	PyObject *func, *alist = NULL, *kwdict = NULL;
-	PyObject *t = NULL, *retval = NULL;
-
-	if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict))
-		return NULL;
-	if (alist != NULL) {
-		if (!PyTuple_Check(alist)) {
-			if (!PySequence_Check(alist)) {
-				PyErr_Format(PyExc_TypeError,
-				 "apply() arg 2 expected sequence, found %s",
-					 alist->ob_type->tp_name);
-				return NULL;
-			}
-			t = PySequence_Tuple(alist);
-			if (t == NULL)
-				return NULL;
-			alist = t;
-		}
-	}
-	if (kwdict != NULL && !PyDict_Check(kwdict)) {
-		PyErr_Format(PyExc_TypeError,
-			 "apply() arg 3 expected dictionary, found %s",
-			 kwdict->ob_type->tp_name);
-		goto finally;
-	}
-	retval = PyEval_CallObjectWithKeywords(func, alist, kwdict);
- finally:
-	Py_XDECREF(t);
-	return retval;
-}
-
-PyDoc_STRVAR(apply_doc,
-"apply(object[, args[, kwargs]]) -> value\n\
-\n\
-Call a callable object with positional arguments taken from the tuple args,\n\
-and keyword arguments taken from the optional dictionary kwargs.\n\
-Note that classes are callable, as are instances with a __call__() method.\n\
-\n\
-Deprecated since release 2.3. Instead, use the extended call syntax:\n\
- function(*args, **keywords).");
-
 
 static PyObject *
 builtin_callable(PyObject *self, PyObject *v)
@@ -2090,7 +2046,6 @@
 	{"abs",		builtin_abs, METH_O, abs_doc},
 	{"all",		builtin_all, METH_O, all_doc},
 	{"any",		builtin_any, METH_O, any_doc},
- 	{"apply",	builtin_apply, METH_VARARGS, apply_doc},
 	{"callable",	builtin_callable, METH_O, callable_doc},
 	{"chr",		builtin_chr, METH_VARARGS, chr_doc},
 	{"cmp",		builtin_cmp, METH_VARARGS, cmp_doc},
Modified: python/branches/p3yk/Tools/freeze/freeze.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/freeze.py	(original)
+++ python/branches/p3yk/Tools/freeze/freeze.py	Fri Mar 17 09:00:19 2006
@@ -194,7 +194,7 @@
 if o == '-l':
 addn_link.append(a)
 if o == '-a':
- apply(modulefinder.AddPackagePath, tuple(a.split("=", 2)))
+ modulefinder.AddPackagePath(*a.split("=", 2))
 if o == '-r':
 f,r = a.split("=", 2)
 replace_paths.append( (f,r) )
Modified: python/branches/p3yk/Tools/pynche/pyColorChooser.py
==============================================================================
--- python/branches/p3yk/Tools/pynche/pyColorChooser.py	(original)
+++ python/branches/p3yk/Tools/pynche/pyColorChooser.py	Fri Mar 17 09:00:19 2006
@@ -81,7 +81,7 @@
 """Ask for a color"""
 global _chooser
 if not _chooser:
- _chooser = apply(Chooser, (), options)
+ _chooser = Chooser(**options)
 return _chooser.show(color, options)
 
 def save():
Modified: python/branches/p3yk/Tools/unicode/gencodec.py
==============================================================================
--- python/branches/p3yk/Tools/unicode/gencodec.py	(original)
+++ python/branches/p3yk/Tools/unicode/gencodec.py	Fri Mar 17 09:00:19 2006
@@ -399,6 +399,6 @@
 
 import sys
 if 1:
- apply(convertdir,tuple(sys.argv[1:]))
+ convertdir(*sys.argv[1:])
 else:
- apply(rewritepythondir,tuple(sys.argv[1:]))
+ rewritepythondir(*sys.argv[1:])
Modified: python/branches/p3yk/Tools/webchecker/webchecker.py
==============================================================================
--- python/branches/p3yk/Tools/webchecker/webchecker.py	(original)
+++ python/branches/p3yk/Tools/webchecker/webchecker.py	Fri Mar 17 09:00:19 2006
@@ -684,7 +684,7 @@
 
 def note(self, level, msg, *args):
 if self.checker:
- apply(self.checker.note, (level, msg) + args)
+ self.checker.note(level, msg, *args)
 else:
 if self.verbose >= level:
 if args:
@@ -741,7 +741,7 @@
 
 def __init__(*args):
 self = args[0]
- apply(urllib.FancyURLopener.__init__, args)
+ urllib.FancyURLopener.__init__(*args)
 self.addheaders = [
 ('User-agent', 'Python-webchecker/%s' % __version__),
 ]


More information about the Python-checkins mailing list

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