Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
math.log?
#9
functools.cache is not going to know that expensive_function(6, 4) is the same as expensive_function(4, 6). But if this is an expensive function the order of the arguments is probably important.

Care must be taken if your cached function returns a mutable result. Just last week somebody was using functools to speed up their code and it led to unexpected results because a cached list was returned instead of generating a new list each time.
Reply


Messages In This Thread
math.log? - by Majo - Dec-03-2020, 04:14 PM
RE: math.log? - by Larz60+ - Dec-03-2020, 04:38 PM
RE: math.log? - by ndc85430 - Dec-03-2020, 06:31 PM
RE: math.log? - by deanhystad - Dec-03-2020, 06:41 PM
RE: math.log? - by Majo - Dec-03-2020, 08:31 PM
RE: math.log? - by ndc85430 - Dec-03-2020, 08:46 PM
RE: math.log? - by bowlofred - Dec-03-2020, 10:04 PM
RE: math.log? - by deanhystad - Dec-03-2020, 10:54 PM
RE: math.log? - by deanhystad - Dec-03-2020, 11:06 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  math.log versus math.log10 stevendaprano 10 2,426 May-23-2022, 08:59 PM
Last Post: jefsummers
  Why getting ValueError : Math domain error in trig. function, math.asin() ? jahuja73 3 3,781 Feb-24-2021, 05:09 PM
Last Post: bowlofred

Forum Jump:

User Panel Messages

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