Python Forum
Practice problem using lambda inside the class
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Practice problem using lambda inside the class
#2
Of course you get that output, because check_angles returns a function, which you then need to call.

Having said that, this is not really a good case for using a lambda because here all it does is complicate things. If you at least want to get used to passing functions around, then look at using lambdas with say, map, filter or even passing a function for the key argument of the sorted function (or the sort method on sequences). reduce is another example of a function that takes a function as an argument (a so-called "higher-order function"), but it might be a bit more complicated to understand how it works.
Reply


Messages In This Thread
RE: Practice problem using lambda inside the class - by ndc85430 - Sep-12-2020, 01:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  class definition and problem with a method HerrAyas 2 297 Apr-01-2024, 03:34 PM
Last Post: HerrAyas
  Best practice on using virtual environments in Python bytecrunch 6 923 Feb-14-2024, 03:22 PM
Last Post: snippsat
  Subclass initialized property used in parent class method. Is it bad coding practice? saavedra29 5 1,857 Feb-07-2022, 07:29 PM
Last Post: saavedra29
  best practice for import libraries and using pyinstaller aster 3 2,924 Apr-17-2021, 11:12 AM
Last Post: snippsat
  How to read file inside class Mekala 11 12,627 May-02-2020, 11:36 AM
Last Post: snippsat
  [split] Python Class Problem astral_travel 12 5,052 Apr-29-2020, 07:13 PM
Last Post: michael1789
  Python Class Problem JPCrosby 2 2,314 Apr-28-2020, 06:18 PM
Last Post: buran
  Threading best practice EvanS1 2 1,959 Apr-21-2020, 10:11 PM
Last Post: EvanS1
  Is it mandatory to call superclass init inside the class init? psolar 3 6,112 Feb-14-2020, 09:16 PM
Last Post: wavic
  Class problem duckduck23 2 2,044 Feb-10-2020, 08:52 PM
Last Post: jefsummers

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020