Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23189

How do I rewrite the function without lambda? [closed]

$
0
0

Essententially, I want a list of objects, with attributes of (self, sym:'str', x: int, y: int), to sort alphabetically by the sym attribute. I would include the code, but the above is an imported class and very lengthy. The following line works, but I am trying to rewrite it without lamda.

self.list= sorted(self.list, key=lambda list:list.symbol)

I've tried using a get_sym function for the key from that class, but I get syntax errors. I am not very familiar with using sorted without lamba. I've looked online for similar questions, but I'm not very familiar with anything beyond using a get_item function already established in the class. Any help is appreciated.


Viewing all articles
Browse latest Browse all 23189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>