This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author BTaskaya
Recipients BTaskaya
Date 2021-03-06.11:55:57
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1615031757.71.0.0216210718913.issue43417@roundup.psfhosted.org>
In-reply-to
Content
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))
History
Date User Action Args
2021-03-06 11:55:57BTaskayasetrecipients: + BTaskaya
2021-03-06 11:55:57BTaskayasetmessageid: <1615031757.71.0.0216210718913.issue43417@roundup.psfhosted.org>
2021-03-06 11:55:57BTaskayalinkissue43417 messages
2021-03-06 11:55:57BTaskayacreate