Message388197
Currently, buffer is just an instance-level list that is used in various places to avoid directly writing stuff into the real source buffer, though the design is pretty complicated and hard to use.
There are various use cases (like omitting the empty space when unparsing argument-less lambdas, e.g: lambda : 2 + 2) we could've use this buffer system if it was offering a stackable version (like multiple levels of buffers).
What I think is we should probably do this with a proper context manager and in the context capture all writings into a list where we would return after the context is closed;
with self.buffered() as buffer:
self._write_fstring_inner(node)
return self._write_str_avoiding_backslashes("".join(buffer)) |
|
Date |
User |
Action |
Args |
2021-03-06 11:55:57 | BTaskaya | set | recipients:
+ BTaskaya |
2021-03-06 11:55:57 | BTaskaya | set | messageid: <1615031757.71.0.0216210718913.issue43417@roundup.psfhosted.org> |
2021-03-06 11:55:57 | BTaskaya | link | issue43417 messages |
2021-03-06 11:55:57 | BTaskaya | create | |
|