[libre-riscv-dev] extremely busy crowdsupply update started

Jock Tanner tanner.of.kha at gmail.com
Sun Mar 29 14:23:10 BST 2020


Luke,

I think this code won't always work as intended:

            p = Cfg.getParamInt(attr) # all params have a type
            if p.type == 'Enumerate':
                Cfg.getParamEnumerate(attr).setInt(val)
            else:
                Cfg.getParamInt(attr).setInt(val)

If the parameter named 'attr' is already defined, 'p.type' will be set
according to its type. But for undefined parameters 'p.type' will be
what we ask for, i. e. always 'Int'.

BTW I think it is useless to have a distinction between 'Int' and
'Enumerate' types, as well as between 'Double' and 'Percentage'. But
it's another thing.

On Sat, 2020-03-28 at 23:16 +0000, Luke Kenneth Casson Leighton wrote:
> On Sat, Mar 28, 2020 at 4:45 PM Jean-Paul Chaput
> <Jean-Paul.Chaput at lip6.fr> wrote:
> > > 3.2.3. Data types
> > > 
> > > Python use duck typing, so you should avoid any direct type
> > > indication
> > > or querying in Python.
> > > 
> > > Bad: Cfg.getParamInt('katana.vTracksReservedLocal').setInt(6)
> > > 
> > > Good: Cfg['katana.vTracksReservedLocal'] = 6
> 
> sorted.  jean-paul feel free (after jock's review and highly likely
> automatic reaction to put code-comments in it) to cut/paste the
> Config
> class into coriolis2 somewhere.
> 





More information about the libre-riscv-dev mailing list