Python2017/labs03/task01.py

9 lines
383 B
Python
Raw Normal View History

#lab03 task01
#Returns mutable type names
2017-12-16 02:41:43 +01:00
[t for t, oldid, newid in map( lambda (t, obj, objid): (t, id(obj*1), objid), map(lambda x : (type(x), x, id(x)), [[], '', 3.141592]) ) if oldid == newid]
for type_name, type_mutable in map( lambda t: (type(t), id(t)==id(t*1)), [[], '', 3.141592] ):
print("%s is %s" % (str(type_name), 'mutable' if type_mutable else 'immutable') )