Al 08/05/12 20:42, En/na Emile van Sebille ha escrit:
On 5/8/2012 11:31 AM xancorreu said...
isinstance(2, function)
like I do
isinstance(2, int)
Do you understand my reasoning?
Nope, but here ya go:
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from types import *
>>> dir()
['BooleanType', 'BufferType', 'BuiltinFunctionType',
'BuiltinMethodType', 'ClassType', 'CodeType', 'ComplexType',
'DictProxyType', 'DictType', 'DictionaryType', 'EllipsisType',
'FileType', 'FloatType', 'FrameType', 'FunctionType', 'GeneratorType',
'GetSetDescriptorType', 'InstanceType', 'IntType', 'LambdaType',
'ListType', 'LongType', 'MemberDescriptorType', 'MethodType',
'ModuleType', 'NoneType', 'NotImplementedType', 'ObjectType',
'SliceType', 'StringType', 'StringTypes', 'TracebackType',
'TupleType', 'TypeType', 'UnboundMethodType', 'UnicodeType',
'XRangeType', '__builtins__', '__doc__', '__name__', '__package__']
>>> def test():pass
...
>>>
>>> function=FunctionType
>>> print isinstance(test,function)
>>>
A BIG thank you.
Thanks,
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor