Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
im3w1l
on Dec 29, 2022
|
parent
|
context
|
favorite
| on:
I Lost All Faith in LastPass
Java has try-with-resources for this. Python has
with
. Unlike say C++ you do have to indent your code once for every such resource though which can be cumbersome.
duped
on Dec 29, 2022
[–]
Neither of these things are equivalent to destructors, however
im3w1l
on Dec 30, 2022
|
parent
[–]
They aren't equivalent but they can do the task in question:
with prompt_password() as password: stuff
Once the scope exits, the context manager can scramble the memory.
Consider applying for YC's Summer 2026 batch! Applications are open till May 4
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: