Last active
June 8, 2016 14:43
-
-
Save kmohrf/4675e90714c375fcdc628ad309700ca4 to your computer and use it in GitHub Desktop.
default argument implementations with referenceable datatypes in .js and .py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const create_object = (obj = {}) => obj | |
console.log(create_object() === create_object()) // false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_object(obj = {}): | |
return obj | |
print(create_object() == create_object()) # True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment