# Possible bug in RDataFrame Define with lambdas?

**URL:** <https://root-forum.cern.ch/t/possible-bug-in-rdataframe-define-with-lambdas/51132>\
**Category:** ROOT\
**Tags:** rdataframe, python\
**Created:** [August 10, 2022, 11:10am UTC](https://root-forum.cern.ch/t/possible-bug-in-rdataframe-define-with-lambdas/51132 "2022-08-10T11:10:28Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [August 11, 2022, 5:40pm UTC](https://root-forum.cern.ch/t/possible-bug-in-rdataframe-define-with-lambdas/51132/3 "2022-08-11T17:40:30Z")

</div>

> [@Day](#):
>
> I guess the existance of the return statement inside the lambda confused the compiler into thinking the whole block already had a return statement?

That’s exactly it. I think it would be fair to classify this as a bug, unfortunately it is quite complicated and expensive to do more sophisticated C++ parsing of the string expression to figure out whether it needs a `return` or not. I hope one day someone better than me at parsing C++ will come up with a solution, for now we cannot but live with this limitation

I completely agree with you and @FoxWise that this behavior should at the very least be clearly documented, I opened a pull request [here](https://github.com/root-project/root/pull/11175).

Thank you for the feedback and sorry about the problem!  
Enrico

---

_[View the full topic](https://root-forum.cern.ch/t/possible-bug-in-rdataframe-define-with-lambdas/51132)._
