On Mon, Aug 31, 2020 at 8:11 AM Jeff Long <willco...@gmail.com> wrote:

> Since there is no way of knowing what global names will conflict in the
> future, it could be useful for GRC to prefix ids (id_audio), make them part
> of another structure (ids.audio), or something similar. This adds
> complexity to manual coding in Python, so it's a tradeoff.
>

It would be sufficient to modify the constructor code generation so that
variables aren't used — to use a non-conflicting example from a random
generated .py file I have,
  self.samp_rate = samp_rate = 44100
  ...
  self.audio_sink_0 = audio.sink(samp_rate, "", True)
would be instead generated without a local variable as
  self.samp_rate = 44100
  ...
  self.audio_sink_0 = audio.sink(self.samp_rate, "", True)

If another case arises where that's not sufficient, I think it would still
be a better idea to have GRC detect and alter Python variable names (or,
possibly preferably, the names of module imports) on a case-by-case basis
to avoid worsening readability (and edit distance from hand-maintained GR
code).

Reply via email to