AutoComplete in C++ Editor for Python
Scott David Daniels
Scott.Daniels at Acm.Org
Mon May 4 18:21:18 EDT 2009
flamz3d at gmail.com wrote:
> ... Using this code, I can get information like the name of the symbol
> (x), but I can't figure out how to get the type. If I knew how to get
> this it would solve 99% of my problems :)
If Python were statically typed, you might be correct.
A _value_ in python has a type, not a variable. so, you can do:
some_list = []
for a in None, True, 1, 1.0, 3.1j, 'text', u'text':
some_list.append(a)
print some_list
and you will see something like:
[None, True, 1, 1.0, 3.1000000000000001j, 'text', u'text']
That is, a has the type of its current value.
any kind of object can be stored in any variable.
--Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list