I am using Visual Studio Code for Python development.
A very common expression in python is lambda x: x which can be a little verbose when used 40+ times in a module.
Does VS code allow for this to be replaced with a symbol? eg. replacing lambda with λ?
So code like df.apply(lambda x: x**2) would appear as df.apply(λx: x**2)
To clarify, I DONT want to modify the source code, I just want it to be displayed on my code editor using the shorthand.
Very late to the party, but I recommend using this extension: prettify-symbols-mode
Adding following config to settings.json worked for me:
"prettifySymbolsMode.substitutions": [{
"language": "python",
"revealOn": "active-line",
"substitutions": [
{ "ugly": "lambda", "pretty": "λ", "post": "\\s*(?:\\w|_).*?\\s*:" }
]
}]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With