9 lines
383 B
Python
9 lines
383 B
Python
#lab03 task01
|
|
#Returns mutable type names
|
|
[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') )
|
|
|
|
|