Lambda expressions


#1

why can't we use replace function in this

garbled = "IXXX aXXmX aXXXnXoXXXXXtXhXeXXXXrX sXXXXeXcXXXrXeXt mXXeXsXXXsXaXXXXXXgXeX!XX"
message = filter(lambda x:x!="X" ,garbled)
print message

message = (lambda x : x=garbled.replace("X",""),)
it says lambda cannot contain assignment


#2

Because the object is returned, not in-place.


#3

so we can't use any function under lambda?


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.