jens-scheffler-bosch commented on PR #30704:
URL: https://github.com/apache/airflow/pull/30704#issuecomment-1524026089

   > > > This functionality is basically `functools.lru_cache`.
   > > 
   > > 
   > > yes and no because this is an in-function cache. `functools.lru_cache` 
is intended to provide a cache that is persisted at the object level I think ?
   > 
   > Not realy. @uranusjr is right. lru_cache caches the value of function 
keyed by arguments of the function (the only condition is that the arguments 
must be hashable). So it does precisely what the extra (unneded) code does in 
this case..
   
   Only being a 95% Python expert (need to earn some stars), removing code with 
functools sounds good. But also I suppose adding a `@lru_cache` to 
`self.dagbag.get_dag()` on a general level is not what we want - so to only 
locally optimize I assume the best approach would be also using a `lambda` like 
proposed in answer #1 here? 
https://stackoverflow.com/questions/10270360/python-use-lru-cache-on-lambda-function-or-other-ways-to-create-cache-for-lamb


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to