[Pymultimethods-commits] SF.net SVN: pymultimethods:[34] branches/trac/ticket1/multidispatch.py
Status: Beta
Brought to you by:
davisn
From: <da...@us...> - 2009-07-01 04:33:54
|
Revision: 34 http://pymultimethods.svn.sourceforge.net/pymultimethods/?rev=34&view=rev Author: davisn Date: 2009-07-01 04:33:19 +0000 (Wed, 01 Jul 2009) Log Message: ----------- Refactor getFuncDefaults to use inspect.getargspec Modified Paths: -------------- branches/trac/ticket1/multidispatch.py Modified: branches/trac/ticket1/multidispatch.py =================================================================== --- branches/trac/ticket1/multidispatch.py 2009-07-01 04:03:48 UTC (rev 33) +++ branches/trac/ticket1/multidispatch.py 2009-07-01 04:33:19 UTC (rev 34) @@ -33,15 +33,15 @@ #Everything is anything, the ultimate catch-all yield anything +def getFuncDefaults(func): + return inspect.getargspec(func)[3] + try: #Python 3 doesn't support old-style classes anymore (ClassType) #so this will throw and ImportError from types import ClassType - #Functions to abstract differences between Python 2.x and Python 3 - def getFuncDefaults(func): - return func.func_defaults - + #Function to abstract differences between Python 2.x and Python 3 def getFuncCode(func): return func.func_code @@ -49,10 +49,6 @@ #Python 3 doesn't have old-style types class ClassType(type): pass - #Functions to abstract differences between Python 3 and Python 2.x - def getFuncDefaults(func): - return func.__defaults__ - def getFuncCode(func): return func.__code__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |