Does a block always have to return something?
What you mean is the work function. I know this is a bit nit-picky, but
there has always been a lot of confusion caused by exactly that: The
block is the whole instance of a class derived from gr.block, and the
work() (or general_work()) is the method of that class which gets called
repeatedly at runtime. You can have state as properties of the instance.
I’m not quite sure what the effect of returning None (which is what
happens when you don’t return something in python) is, because that
NoneObject would then be handled through SWIF to C++, and I have no idea
whether SWIG has a uniform way of converting NoneObjects to integers.
In essence: yes, general_work() must always return a number, but in most
cases it’s totally O.K. to return 0 if your block wasn’t able to produce
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.