DEV Community

Discussion on: Equivalents in Python and JavaScript. Part 3

Collapse
 
atrnh profile image
Ashley Trinh

You’re creating a false equivalency between arrow functions and lambda functions. Just because they look syntactically similar doesn’t mean that they have the same behavior.

Lambda functions are Python’s anonymous functions.

Arrow functions are not JavaScript’s anonymous functions, because any type of function can be anonymous.

Both lambda functions and JS functions can be bound to a reference (although you should never do this in Python)

I think the key point here is that functions are first order objects in JavaScript and Python. That’s how they’re similar.

Collapse
 
djangotricks profile image
Aidas Bendoraitis

I would say that they might be implemented differently architecturally, but the behaviors of my given examples are equivalent.