discuss-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using forgotten id breaks gnuradio-companion


From: Kevin Reid
Subject: Re: Using forgotten id breaks gnuradio-companion
Date: Mon, 31 Aug 2020 08:45:31 -0700

On Mon, Aug 31, 2020 at 8:11 AM Jeff Long <willcode4@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

[Prev in Thread] Current Thread [Next in Thread]